Gregniuki commited on
Commit
47cfbd5
1 Parent(s): 7423bd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -294,10 +294,15 @@ async def register_post(
294
 
295
  # Redirect to the protected route
296
  url = app.url_path_for("get_protected")
297
- response = RedirectResponse(url, status_code=status.HTTP_303_SEE_OTHER)
298
  # response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
299
- response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True, secure=True, samesite='Lax')
300
- return response
 
 
 
 
 
301
 
302
  except HTTPException as e:
303
  return templates.TemplateResponse("register.html", {"request": request, "error_message": e.detail})
 
294
 
295
  # Redirect to the protected route
296
  url = app.url_path_for("get_protected")
297
+ #response = RedirectResponse(url, status_code=status.HTTP_303_SEE_OTHER)
298
  # response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
299
+ #response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True, secure=True, samesite='Lax')
300
+ #return response
301
+ # Return the access token and redirection URL in the response
302
+ return JSONResponse(content={
303
+ "access_token": access_token,
304
+ "redirect_url": url
305
+ })
306
 
307
  except HTTPException as e:
308
  return templates.TemplateResponse("register.html", {"request": request, "error_message": e.detail})