Skip to content

Commit f39f5da

Browse files
authored
Merge pull request #8 from puentesarrin/scope_as_default
Scope can be configured in settings file
2 parents 411a44f + f743f89 commit f39f5da

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ Step 6: Set up all the correct options (see below for available options)
5757
* OAUTHADMIN_CLIENT_ID: Your oAuth client ID
5858
* OAUTHADMIN_CLIENT_SECRET: oAuth client secret
5959
* OAUTHADMIN_BASE_URL: The landing point for all oAuth related queries.
60-
* OATHADMIN_AUTH_URL: oAuth provider URL
60+
* OAUTHADMIN_AUTH_URL: oAuth provider URL
6161
* OAUTHADMIN_TOKEN_URL: oAuth bearer token provider URL
6262
* OAUTHADMIN_PING_INTERVAL (optional, defaults to 300): Minimum number of seconds between ping requests
6363
* OAUTHADMIN_PING: (optional, defaults to None) This optional function takes an oauth token and returns True if it's still valid and False if it's no longer valid (if they have logged out of the oauth server)
6464
* OAUTHADMIN_DEFAULT_NEXT_URL: (optional, defaults to /admin). This optional value is the default page that a successful oauth login process will land you on.
65+
* OAUTHADMIN_SCOPE: (optional, defaults to ['default']). This is a list of authorization scopes.
6566

6667
## Testing
6768

oauthadmin/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"GET_USER": 'oauthadmin.stubs.get_user',
66
"PING_INTERVAL": 300,
77
"OAUTHADMIN_DEFAULT_NEXT_URL": "/admin/",
8+
"SCOPE": ['default'],
89
}
910

1011
global_prefix = 'OAUTHADMIN_'

oauthadmin/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def login(request):
5454
oauth = OAuth2Session(
5555
client_id=app_setting('CLIENT_ID'),
5656
redirect_uri=redirect_uri,
57-
scope=["default"],
57+
scope=app_setting('SCOPE'),
5858
state=state,
5959
)
6060
authorization_url, state = oauth.authorization_url(app_setting('AUTH_URL'))

0 commit comments

Comments
 (0)