Help needed on OpenID flow #30
Replies: 3 comments 5 replies
-
response from @frankie567 Then, on your backend, you could just go with the basic FastAPI example: it’ll just wait for the access token passed in headers and validate it. The backend doesn’t know / care about how to ask for a fresh token, it just uses it. Hope it clarifies things a bit! |
Beta Was this translation helpful? Give feedback.
-
If I understand correctly, we'll be using frontend to get a temporary code, called the authorization code. Then backend can use this authorization code to get stuff like authorization token or ID token (this step verifies the user supplies a valid code, which means the user is signed in and authenticated). And then it would be our backend's responsibility to manage and maintain our own session right? For example, after getting ID token, we may respond to frontend with set-cookie directive to set this value to a http-only, secure cookie. |
Beta Was this translation helpful? Give feedback.
-
Reopening this discussion. If we are doing everything in the frontend (quote: The frontend makes an AJAX request to Fief to exchange the authorization code with an access token and an ID token), aren't we putting client secret in the frontend? Isn't this a bad idea (security wise)? |
Beta Was this translation helpful? Give feedback.
-
[re-post the discussino from an email thread]
I have a project that clearly separates frontend and backend apps, and I read the tutorial for setting up backend fastapi with fief, I don't really understand how to proceed. In the tutorial it uses fastapi's swagger doc to demonstrate the login flow, which requires us to input oauth client id and client secret, and then authorize with swagger doc.
So in my scenario, I still implement the similar code (as in tutorial) in the backend fastapi app, but how should I set up the frontend part of the code? When frontend app clicks login, should I be asking the backend app to send me auth_url? Or should I add client id to frontend so that frontend can generate auth_url on its own? And in either way, after the auth_url grant is successful, I only get a code, and I am supposed to use the code to further get my access token and id token right? then should I be using the backend or frontend to fetch these 2 tokens? And where should I be storing these tokens?
Beta Was this translation helpful? Give feedback.
All reactions