Skip to content

Commit

Permalink
update callback url for oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Jul 1, 2024
1 parent f950ecb commit 3bb79e3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend/app/users/oauth_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from app.users.user_routes import router
from app.users.user_deps import init_google_auth, login_required
from app.users.user_schemas import AuthUser
from app.users import user_crud
from app.config import settings


if settings.DEBUG:
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

Expand Down Expand Up @@ -39,7 +41,11 @@ async def callback(request: Request, google_auth=Depends(init_google_auth)):

callback_url = str(request.url)
access_token = google_auth.callback(callback_url).get("access_token")
return access_token

user_data = google_auth.deserialize_access_token(access_token)
access_token, refresh_token = user_crud.create_access_token(user_data)

return {"access_token": access_token, "refresh_token": refresh_token}


@router.get("/my-info/")
Expand Down

0 comments on commit 3bb79e3

Please sign in to comment.