|
14 | 14 | app = Flask(__name__) |
15 | 15 | bb = BlueButton() |
16 | 16 |
|
| 17 | +## helper trouble shoot |
| 18 | +def print_setting(): |
| 19 | + print("URL::BlueButton->base_url: {}".format(bb.base_url), flush=True) |
| 20 | + print("URL::BlueButton->auth_base_url: {}".format(bb.auth_base_url), flush=True) |
| 21 | + print("URL::BlueButton->auth_token_url: {}".format(bb.auth_token_url), flush=True) |
| 22 | + print("URL::BlueButton->callback_url: {}".format(bb.callback_url), flush=True) |
| 23 | + |
| 24 | + |
| 25 | +app = Flask(__name__) |
| 26 | +bb = BlueButton() |
| 27 | + |
| 28 | +host_ip = os.environ.get("HOST_IP") |
| 29 | + |
| 30 | +print_setting() |
| 31 | + |
| 32 | +if host_ip: |
| 33 | + if str(bb.base_url).startswith("http://localhost"): |
| 34 | + bb.base_url = str(bb.base_url).replace("http://localhost", "http://{}".format(host_ip)) |
| 35 | + if str(bb.auth_base_url).startswith("http://localhost"): |
| 36 | + bb.auth_base_url = str(bb.auth_base_url).replace("http://localhost", "http://{}".format(host_ip)) |
| 37 | + if str(bb.auth_token_url).startswith("http://localhost"): |
| 38 | + bb.auth_token_url = str(bb.auth_token_url).replace("http://localhost", "http://{}".format(host_ip)) |
| 39 | + print_setting() |
| 40 | + |
17 | 41 | # This is where medicare.gov beneficiary associated |
18 | 42 | # with the current logged in app user, |
19 | 43 | # in real app, this could be the app specific |
|
35 | 59 |
|
36 | 60 | @app.route('/api/authorize/authurl', methods=['GET']) |
37 | 61 | def get_auth_url(): |
38 | | - redirect_url = bb.generate_authorize_url(auth_data) |
| 62 | + # for SMART App v2 scopes usage: explicitly |
| 63 | + # provide query parameter scope=<v2 scopes> |
| 64 | + # where <v2 scopes> is space delimited v2 scope specs (url encoded) |
| 65 | + # e.g. patient/ExplanationOfBenefit.rs |
| 66 | + redirect_url = bb.generate_authorize_url(auth_data) + "&scope=patient%2FPatient.s%20patient%2FExplanationOfBenefit.rs" |
39 | 67 | return redirect_url |
40 | 68 |
|
41 | 69 |
|
|
0 commit comments