Gregniuki commited on
Commit
b7bbd14
1 Parent(s): 4f3680e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -58,10 +58,14 @@ async def login_post(
58
  expires_delta=timedelta(minutes=auth_views.ACCESS_TOKEN_EXPIRE_MINUTES)
59
  )
60
 
61
- response = RedirectResponse(url="/protected", status_code=status.HTTP_303_SEE_OTHER)
 
 
 
 
62
  #response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
63
- response.set_cookie(key="access_token", value=access_token, httponly=True)
64
- return response
65
  elif user and not user.is_verified: # User is not verified
66
  raise HTTPException(
67
  status_code=400,
 
58
  expires_delta=timedelta(minutes=auth_views.ACCESS_TOKEN_EXPIRE_MINUTES)
59
  )
60
 
61
+ # Redirect the user to the protected route with the token in the URL
62
+ url = app.url_path_for("get_protected") # Ensure you have a name="get_protected" in your app.get("/protected") decorator
63
+ return RedirectResponse(f"{url}?token={access_token}")
64
+
65
+ #response = RedirectResponse(url="/protected", status_code=status.HTTP_303_SEE_OTHER)
66
  #response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
67
+ # response.set_cookie(key="access_token", value=access_token, httponly=True)
68
+ # return response
69
  elif user and not user.is_verified: # User is not verified
70
  raise HTTPException(
71
  status_code=400,