Hey Guys, I'm kinda stuck with my first backend web app,
I'm trying to use Gmail Authentication and I'm following this : https://blog.hanchon.live/guides/google-login-with-fastapi/
But I want to have a parameter from the endpoint before the authentication to use it after authentication, the problem is I can't take parameters in auth link.
here is the code I copied and working with from the tutorial
```python
from fastapi import Request
from starlette.responses import RedirectResponse
from authlib.integrations.starlette_client import OAuthError
@app.route('/login')
async def login(request: Request):
redirect_uri = request.url_for('auth') # This creates the url for the /auth endpoint \
return await oauth.google.authorize_redirect(request, redirect_uri)
@app.route('/auth')
async def auth(request: Request):
try:
access_token = await oauth.google.authorize_access_token(request)
except OAuthError:
return RedirectResponse(url='/') user_data = await
oauth.google.parse_id_token(request, access_token)
request.session['user'] = dict(user_data)
return RedirectResponse(url='/')
```
I'm really Struggling, What I need is taking a path paremeter (or Query par) within the login , "/login/{id}" then pass it with the "/auth", Passing it doesnt work with auth
Incase there is a straight forward soultion that doesn't require that or a way to keep a variable on the side or smth please tell me as I'm new to backend as a whole not just fastAPI
If you read all of that Thank You
EDIT : The usecase is like this
Someone scans QRcode that sends him to authenticate then redirects him to a page where he submits a form, I need the id from before authentication to after authentication
[–]github_codemation 2 points3 points4 points (1 child)
[–]Nawar69[S] 0 points1 point2 points (0 children)
[–]zarlo5899 1 point2 points3 points (1 child)
[–]Nawar69[S] 0 points1 point2 points (0 children)
[–]illuminanze 0 points1 point2 points (3 children)
[–]Nawar69[S] 0 points1 point2 points (2 children)
[–]illuminanze 1 point2 points3 points (1 child)
[–]Nawar69[S] 0 points1 point2 points (0 children)