Google Oauth success redirect with React app #1366
-
Hi! Currently doing setup of Google OAuth using this docs: Here is code for Google OAuth router:
It works well on oauth callback - we get user login at backend So I found solution to handle redirect it in UserManager on_after_login method.
And then on frontend in React to handle /oauth-success route: And OAuthSuccess component where I handle token from location.hash and store to LocalStorage:
And here is two questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think this answers your question |
Beta Was this translation helpful? Give feedback.
-
Thanks, @hgalytoby for suggestion. So here I will publish full React frontend solution for all, who will have such question in future :) And here is simple part what we need to implement additionally to this docs:
|
Beta Was this translation helpful? Give feedback.
Thanks, @hgalytoby for suggestion.
So here I will publish full React frontend solution for all, who will have such question in future :)
Here is full boilerplate implementation of fastapi-users + beanie + oauth + react:
https://github.com/philipshurpik/fastapi-oauth-mongo-react-starter
And here is simple part what we need to implement additionally to this docs:
https://fastapi-users.github.io/fastapi-users/latest/configuration/oauth/#beanie
<Route path="/oauth-callback" element={<OAuthCallback />} />