|
3 | 3 |
|
4 | 4 |
|
5 | 5 | import requests |
6 | | -from flask import current_app as app, url_for, redirect, render_template, request |
| 6 | +from flask import current_app as app, url_for, redirect, render_template, request, session |
7 | 7 | from flask_oauthlib.client import OAuth |
8 | 8 | from docusign_esign import ApiClient |
9 | 9 | from docusign_esign.client.api_exception import ApiException |
@@ -45,11 +45,11 @@ def _init(cls, auth_type): |
45 | 45 | def _auth_code_grant(cls): |
46 | 46 | """Authorize with the Authorization Code Grant - OAuth 2.0 flow""" |
47 | 47 | oauth = OAuth(app) |
48 | | - if EXAMPLES_API_TYPE["Rooms"]: |
| 48 | + if session["chosen_api"] == "rooms": |
49 | 49 | use_scopes = ROOMS_SCOPES |
50 | | - elif EXAMPLES_API_TYPE["Click"]: |
| 50 | + elif session["chosen_api"] == "click": |
51 | 51 | use_scopes = CLICK_SCOPES |
52 | | - elif EXAMPLES_API_TYPE["Admin"]: |
| 52 | + elif session["chosen_api"] == "admin": |
53 | 53 | use_scopes = ADMIN_SCOPES |
54 | 54 | else: |
55 | 55 | use_scopes = SCOPES |
@@ -77,11 +77,11 @@ def _jwt_auth(cls): |
77 | 77 | api_client = ApiClient() |
78 | 78 | api_client.set_base_path(DS_JWT["authorization_server"]) |
79 | 79 |
|
80 | | - if EXAMPLES_API_TYPE["Rooms"]: |
| 80 | + if session["chosen_api"] == "rooms": |
81 | 81 | use_scopes = ROOMS_SCOPES |
82 | | - elif EXAMPLES_API_TYPE["Click"]: |
| 82 | + elif session["chosen_api"] == "click": |
83 | 83 | use_scopes = CLICK_SCOPES |
84 | | - elif EXAMPLES_API_TYPE["Admin"]: |
| 84 | + elif session["chosen_api"] == "admin": |
85 | 85 | use_scopes=ADMIN_SCOPES |
86 | 86 | else: |
87 | 87 | use_scopes = SCOPES |
@@ -122,6 +122,7 @@ def _jwt_auth(cls): |
122 | 122 | else: |
123 | 123 | process_error(err) |
124 | 124 |
|
| 125 | + |
125 | 126 | @classmethod |
126 | 127 | def destroy(cls): |
127 | 128 | cls.ds_app = None |
|
0 commit comments