Giter Site home page Giter Site logo

Comments (2)

begedin avatar begedin commented on September 28, 2024

Trying to wrap my head around this, so making some notes. The approach would be similar as with Facebook.

My assumption is that we want the usual flow, where the user authorizes the app on github and then they get taken back to the register screen, where their info is is filled in and can be edited.

https://developer.github.com/v3/oauth/

Ember app

  • User decided to register through github. client_id, redirect_uri, scope and state need to be provided. Scope should be set to "user", or "user:email" or something appropriate (see link above)
  • Once the GitHub side of things is done, we will get a code back
  • We use the code, alongside other parameters, including client_id and client_secret to get back an access token.
  • We use the access token to get user information and fill in the form
  • Once user agrees on the information and submits, we send the info, alongside the access token, to github. There is no equivalent of facebook_id, but I guess we could use the github username for that.

API

  • users#create is called and the payload is very similar to regular user creation, which diverges from how facebook does it.
  • There's a github_access_token and a github_username parameter.
  • We store those in new db columns for later access
  • If params contain an image, then that's it. We save and render the user
  • If there is no image, then we call a worker to set the image from GitHub
    • We can use the Octokit gem for this.

The problem here is that quite a lot needs to be done on the client side to pre-fill the information. Maybe a good alternative would be to

  • I'm pretty sure we still need to get an access token on the client side
  • We send the access_token to the API, there we use it and Octokit to fill out the user information GitHub has available and then, when the API finally responds, the client APP can redirect to the edit profile route.

from deprecated-code-corps-rails-api.

joshsmith avatar joshsmith commented on September 28, 2024

Closed in favor of #9.

from deprecated-code-corps-rails-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.