|
23 | 23 |
|
24 | 24 | try:
|
25 | 25 | oauth_result = auth_flow.finish(auth_code)
|
26 |
| - # Oauth token has files.metadata.read scope only |
| 26 | + # authorization has files.metadata.read scope only |
27 | 27 | assert oauth_result.scope == 'files.metadata.read'
|
28 | 28 | except Exception as e:
|
29 | 29 | print('Error: %s' % (e,))
|
|
33 | 33 | auth_flow2 = DropboxOAuth2FlowNoRedirect(APP_KEY,
|
34 | 34 | consumer_secret=APP_SECRET,
|
35 | 35 | token_access_type='offline',
|
36 |
| - scope=['files.metadata.write']) |
| 36 | + scope=['account_info.read']) |
37 | 37 |
|
38 | 38 | authorize_url = auth_flow2.start()
|
39 | 39 | print("1. Go to: " + authorize_url)
|
|
43 | 43 |
|
44 | 44 | try:
|
45 | 45 | 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' |
48 | 48 | except Exception as e:
|
49 | 49 | print('Error: %s' % (e,))
|
50 | 50 | exit(1)
|
|
66 | 66 | try:
|
67 | 67 | oauth_result = auth_flow3.finish(auth_code)
|
68 | 68 | 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 |
71 | 71 | assert 'files.metadata.read' in oauth_result.scope
|
72 | 72 | assert 'files.content.read' in oauth_result.scope
|
73 | 73 | assert 'files.content.write' in oauth_result.scope
|
|
80 | 80 | oauth2_access_token_expiration=oauth_result.expires_at,
|
81 | 81 | oauth2_refresh_token=oauth_result.refresh_token,
|
82 | 82 | app_key=APP_KEY,
|
83 |
| - app_secret=APP_SECRET): |
| 83 | + app_secret=APP_SECRET) as dbx: |
| 84 | + dbx.users_get_current_account() |
84 | 85 | print("Successfully set up client!")
|
0 commit comments