Skip to content

Commit 487793d

Browse files
authored
Update the commandline-oauth-scopes.py example (#470)
1 parent 223fe46 commit 487793d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

example/oauth/commandline-oauth-scopes.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
try:
2525
oauth_result = auth_flow.finish(auth_code)
26-
# Oauth token has files.metadata.read scope only
26+
# authorization has files.metadata.read scope only
2727
assert oauth_result.scope == 'files.metadata.read'
2828
except Exception as e:
2929
print('Error: %s' % (e,))
@@ -33,7 +33,7 @@
3333
auth_flow2 = DropboxOAuth2FlowNoRedirect(APP_KEY,
3434
consumer_secret=APP_SECRET,
3535
token_access_type='offline',
36-
scope=['files.metadata.write'])
36+
scope=['account_info.read'])
3737

3838
authorize_url = auth_flow2.start()
3939
print("1. Go to: " + authorize_url)
@@ -43,8 +43,8 @@
4343

4444
try:
4545
oauth_result = auth_flow2.finish(auth_code)
46-
# Oauth token has files.metadata.write scope only
47-
assert oauth_result.scope == 'files.metadata.write'
46+
# authorization has account_info.read scope only
47+
assert oauth_result.scope == 'account_info.read'
4848
except Exception as e:
4949
print('Error: %s' % (e,))
5050
exit(1)
@@ -66,8 +66,8 @@
6666
try:
6767
oauth_result = auth_flow3.finish(auth_code)
6868
print(oauth_result)
69-
# Oauth token has all granted user scopes
70-
assert 'files.metadata.write' in oauth_result.scope
69+
# authorization has all granted user scopes
70+
assert 'account_info.read' in oauth_result.scope
7171
assert 'files.metadata.read' in oauth_result.scope
7272
assert 'files.content.read' in oauth_result.scope
7373
assert 'files.content.write' in oauth_result.scope
@@ -80,5 +80,6 @@
8080
oauth2_access_token_expiration=oauth_result.expires_at,
8181
oauth2_refresh_token=oauth_result.refresh_token,
8282
app_key=APP_KEY,
83-
app_secret=APP_SECRET):
83+
app_secret=APP_SECRET) as dbx:
84+
dbx.users_get_current_account()
8485
print("Successfully set up client!")

0 commit comments

Comments
 (0)