Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation missing for DRF TokenHasResourceScope behavior #410

Open
evitolins opened this issue Aug 24, 2016 · 2 comments
Open

Documentation missing for DRF TokenHasResourceScope behavior #410

evitolins opened this issue Aug 24, 2016 · 2 comments

Comments

@evitolins
Copy link

evitolins commented Aug 24, 2016

The DRF permissions class TokenHasResourceScope requires tokens use a colon-separated syntax to explicitly specify read/write scopes (ie. "music:read music:write"). This scope syntax is mentioned nowhere within the docs as far as I've found.

The following info seems like it would be necessary to understand to successfully utilize this workflow.


Based on this example from the TokenHasResourceScope docs....

class SongView(views.APIView):
    authentication_classes = [OAuth2Authentication]
    permission_classes = [TokenHasResourceScope]
    required_scopes = ['music']
    ...

Token Scope Syntax

A valid token's scope is set in this fashion, to grant both read and write permissions for this view.

music:read music:write

However, defining a token's scope without appending specific read and/or write access will not work

music

Settings

Within your scope settings, you must declare each scope explicitly

OAUTH2_PROVIDER = {
    'SCOPES': {
        'music:read' : 'Read music accessible by your account.',
        'music:write' : 'Write music accessible by your account.',
        ...
    }
@philsheard
Copy link

I just found this issue today, trying to work out the docs. Is there anything that I could do to help get into the docs for others? I could raise a PR with the changes required?

@auvipy
Copy link
Contributor

auvipy commented Oct 26, 2021

yes please send a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants