From 7ded448722d93f5a751f7a425c55493d193dc81d Mon Sep 17 00:00:00 2001 From: Kartik Ohri Date: Sat, 27 Apr 2024 01:29:06 +0530 Subject: [PATCH] Use updated scopes for new oauth provider --- critiquebrainz/frontend/views/oauth.py | 2 +- critiquebrainz/ws/oauth/provider.py | 3 ++- docker/docker-compose.dev.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/critiquebrainz/frontend/views/oauth.py b/critiquebrainz/frontend/views/oauth.py index c08e06057..5310bd0e9 100644 --- a/critiquebrainz/frontend/views/oauth.py +++ b/critiquebrainz/frontend/views/oauth.py @@ -35,4 +35,4 @@ def authorize_prompt(): code = oauth.generate_grant(client_id, current_user.id, redirect_uri, scope) return redirect(build_url(redirect_uri, dict(code=code, state=state))) except OAuthError as e: - raise BadRequest(e.desc) \ No newline at end of file + raise BadRequest(e.desc) diff --git a/critiquebrainz/ws/oauth/provider.py b/critiquebrainz/ws/oauth/provider.py index 313cce5ba..df2e1480e 100644 --- a/critiquebrainz/ws/oauth/provider.py +++ b/critiquebrainz/ws/oauth/provider.py @@ -212,7 +212,8 @@ def get_authorized_user(self, scopes): raise exceptions.InvalidToken token_scopes = token["scope"] - for scope in scopes: + new_scopes = [f"critiquebrainz:{s}" for s in scopes] + for scope in new_scopes: if scope not in token_scopes: raise exceptions.InvalidToken diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index e4a1a1d43..6bec1f037 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -57,4 +57,4 @@ services: dockerfile: Dockerfile.webpack command: npm run dev volumes: - - ..:/code:z + - ../critiquebrainz:/code/critiquebrainz:z