johndpjr / AgTern

19 stars 5 forks source link

Research OAuth 2.0 #147

Closed johndpjr closed 10 months ago

johndpjr commented 11 months ago

Context

Right now we just have a username and password login w/ JWT, but it would be really great to have a Google Account login for users if they want to choose that option. Supporting this on the backend should be relatively easy since we have nearly all the login infrastructure complete already (might need to add a few endpoints).

TODO

Notes

This ticket is just researching the steps, but requires some comprehensive research and a report. You won't need to implement it just yet, as that will be another ticket.

zaheersufi commented 10 months ago

Steps:

  1. Setting up Google Developer console. https://console.developers.google.com/
    • Enable Google+ API and create OAuth 2.0 credentials
  2. Implementing OAuth in fastAPI: easier to use a library to handle authentication flows such as OAuthlib/Authlib
    • Configure OAuth provider to work with Google’s endpoints and credentials
  3. FastAPI Endpoints: Implementing the endpoints to handle callbacks form OAuth and getting the information for each user
    • Exchange authorization code for an access token using Google’s OAuth endpoint
  4. Use the current User database:
    • Be able to fit data with current user database
  5. User authorization: Be able to access data when signed in
  6. Make angular google-signup component:
    • In frontend add the button to sign up with google, that’ll redirect to an endpoint on backend which will sign up with google
johndpjr commented 10 months ago

I found this tutorial that lays out one way of doing it really well. I think we'll use some kind of google_id, or just when signing up with Google, we connect/compare their email to an account. When signing in, we could compare the email returned.