From 8673f2044068fe5793eb476a508866e29e9150b9 Mon Sep 17 00:00:00 2001 From: gustavomm19 Date: Fri, 21 Feb 2025 16:18:13 +0000 Subject: [PATCH] fix the scopes for simple auth --- breathecode/authenticate/views.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/breathecode/authenticate/views.py b/breathecode/authenticate/views.py index 1277e9229..0bf0b6397 100644 --- a/breathecode/authenticate/views.py +++ b/breathecode/authenticate/views.py @@ -82,11 +82,11 @@ CredentialsFacebook, CredentialsGithub, CredentialsGoogle, - NotFoundAnonGoogleUser, CredentialsSlack, GithubAcademyUser, GitpodUser, GoogleWebhook, + NotFoundAnonGoogleUser, Profile, ProfileAcademy, Role, @@ -2203,11 +2203,15 @@ def get_google_token(request, token=None): state = f"token={token.key if token is not None else ""}&url={url}" scopes = [ - "https://www.googleapis.com/auth/meetings.space.created", - "https://www.googleapis.com/auth/drive.meet.readonly", "https://www.googleapis.com/auth/userinfo.profile", ] + if token is not None: + scopes = scopes + [ + "https://www.googleapis.com/auth/meetings.space.created", + "https://www.googleapis.com/auth/drive.meet.readonly", + ] + if academy_settings in ["overwrite", "set"]: if feature.is_enabled("authenticate.set_google_credentials", default=False) is False: raise ValidationException( @@ -2262,6 +2266,8 @@ async def async_iter(iterable: list): logger.debug("Google callback just landed") logger.debug(request.query_params) + print("Google callback just landed") + print(request.query_params) error = request.query_params.get("error", False) error_description = request.query_params.get("error_description", "")