Spaces:
Sleeping
Sleeping
auth.py
CHANGED
|
@@ -54,10 +54,12 @@ async def oauth_redirect_callback(request: Request) -> RedirectResponse:
|
|
| 54 |
try:
|
| 55 |
token = await oauth.huggingface.authorize_access_token(request)
|
| 56 |
request.session["user"] = token["userinfo"] # TODO: we should store the entire token
|
|
|
|
| 57 |
close_tab = True
|
| 58 |
except MismatchingStateError:
|
| 59 |
# Third-party cookies are most likely forbidden meaning the session will not be set inside the Space iframe.
|
| 60 |
# To counterpart this, we redirect the user to use the Space url outside of the iframe.
|
|
|
|
| 61 |
close_tab = False
|
| 62 |
|
| 63 |
return CLOSE_WINDOW_HTML if close_tab else OPEN_WINDOW_HTML.format(url=request.url_for("oauth_login"))
|
|
|
|
| 54 |
try:
|
| 55 |
token = await oauth.huggingface.authorize_access_token(request)
|
| 56 |
request.session["user"] = token["userinfo"] # TODO: we should store the entire token
|
| 57 |
+
print("New user: ", token["userinfo"]["name"])
|
| 58 |
close_tab = True
|
| 59 |
except MismatchingStateError:
|
| 60 |
# Third-party cookies are most likely forbidden meaning the session will not be set inside the Space iframe.
|
| 61 |
# To counterpart this, we redirect the user to use the Space url outside of the iframe.
|
| 62 |
+
print("Mismatch error: open in new window")
|
| 63 |
close_tab = False
|
| 64 |
|
| 65 |
return CLOSE_WINDOW_HTML if close_tab else OPEN_WINDOW_HTML.format(url=request.url_for("oauth_login"))
|