File tree Expand file tree Collapse file tree 10 files changed +42
-27
lines changed Expand file tree Collapse file tree 10 files changed +42
-27
lines changed Original file line number Diff line number Diff line change 1
1
# Note: If you are using Azure App Service, go to your app's Configuration,
2
2
# and then set the following values into your app's "Application settings".
3
3
4
- FLASK_DEBUG = True
4
+ CLIENT_ID = <client id>
5
+ CLIENT_SECRET = <client secret>
6
+
5
7
# Expects a full tenant id such as "contoso.onmicrosoft.com", or its GUID
6
8
# Or leave it undefined if you are building a multi-tenant app
7
9
# TENANT_ID=<tenant id>
8
- CLIENT_ID = <client id>
9
- CLIENT_SECRET = <client secret>
Original file line number Diff line number Diff line change 1
1
# Note: If you are using Azure App Service, go to your app's Configuration,
2
2
# and then set the following values into your app's "Application settings".
3
-
4
- FLASK_DEBUG=True
5
- # Expects the display name such as "contoso"
6
- TENANT_NAME=<tenant name>
7
3
CLIENT_ID=<client id>
8
4
CLIENT_SECRET=<client secret>
5
+ # Expects the display name such as "contoso"
6
+ TENANT_NAME=<tenant name>
9
7
SIGNUPSIGNIN_USER_FLOW=B2C_1_profile_editing
10
8
EDITPROFILE_USER_FLOW=B2C_1_reset_password
11
- RESETPASSWORD_USER_FLOW=B2C_1_signupsignin1
9
+ RESETPASSWORD_USER_FLOW=B2C_1_signupsignin1
Original file line number Diff line number Diff line change @@ -32,11 +32,7 @@ Here we will describe how to deploy it to
32
32
will be automatically created with the shape as ` your_app_name\$your_app_name ` .
33
33
But your actual git username is only the ` $your_app_name ` part.
34
34
35
- * Do not forget to setup
36
- [ several environment variables] ( https://github.com/Azure-Samples/ms-identity-python-webapp/blob/master/.env.sample )
37
- needed by this sample.
38
- Otherwise your website will usually render a blank "Internal Error" page
39
- (Flask's debug mode output does not seem to be relayed by App Service).
35
+ * [ Configure your app's settings] ( https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#configure-app-settings ) to define [ these environment variables] ( https://github.com/Azure-Samples/ms-identity-python-webapp/blob/master/.env.sample ) .
40
36
41
37
42
38
## Contributing
Original file line number Diff line number Diff line change @@ -51,10 +51,7 @@ def index():
51
51
if not (app .config ["CLIENT_ID" ] and app .config ["CLIENT_SECRET" ]):
52
52
# This check is not strictly necessary.
53
53
# You can remove this check from your production code.
54
- return """Almost there. Did you forget to set up
55
- <a target=_blank
56
- href="https://github.com/Azure-Samples/ms-identity-python-webapp/blob/master/.env.sample">
57
- necessary environment variables</a> for your deployment?"""
54
+ return render_template ('config_error.html' )
58
55
if not auth .get_user ():
59
56
return redirect (url_for ("login" ))
60
57
return render_template ('index.html' , user = auth .get_user (), version = identity .__version__ )
Original file line number Diff line number Diff line change 1
- Flask >= 2
1
+ # Our how-to docs will use --debug parameter which is only available in Flask 2.2+
2
+ Flask >= 2.2
2
3
# If Flask-Session is not maintained in future, Flask-Session2 should work as well
3
4
Flask-Session >= 0.3.2 ,< 0.5
4
5
werkzeug >= 2
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
-
6
5
{% if config.get("B2C_RESET_PASSWORD_AUTHORITY") and "AADB2C90118" in result.get("error_description") %} <!-- This will be reached when user forgot their password -->
7
6
<!-- See also https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-policies#linking-user-flows -->
8
7
< meta http-equiv ="refresh " content ='0;{{config.get("B2C_RESET_PASSWORD_AUTHORITY")}}?client_id={{config.get("CLIENT_ID")}} '>
9
8
{% endif %}
9
+ < title > Microsoft Identity Python Web App: Error</ title >
10
10
</ head >
11
11
< body >
12
12
< h2 > Login Failure</ h2 >
@@ -18,4 +18,3 @@ <h2>Login Failure</h2>
18
18
< a href ="{{ url_for('index') }} "> Homepage</ a >
19
19
</ body >
20
20
</ html >
21
-
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Microsoft Identity Python Web App: Error</ title >
6
+ </ head >
7
+ < body >
8
+ < h2 > Config Missing</ h2 >
9
+ < p >
10
+ Almost there. Did you forget to set up
11
+ < a target =_blank
12
+ href ="https://learn.microsoft.com/azure/active-directory/develop/web-app-quickstart?pivots=devlang-python#step-5-configure-the-sample-app ">
13
+ necessary environment variables</ a > for your deployment?
14
+ </ p >
15
+ < hr >
16
+ < a href ="{{ url_for('index') }} "> Homepage</ a >
17
+ </ body >
18
+ </ html >
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
+ < title > Microsoft Identity Python Web App: API</ title >
5
6
</ head >
6
7
< body >
7
8
< a href ="javascript:window.history.go(-1) "> Back</ a > <!-- Displayed on top of a potentially large JSON response, so it will remain visible -->
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
+ < title > Microsoft Identity Python Web App: Index</ title >
5
6
</ head >
6
7
< body >
7
8
< h1 > Microsoft Identity Python Web App</ h1 >
8
9
< h2 > Welcome {{ user.get("name") }}!</ h2 >
9
10
11
+ < ul >
10
12
{% if config.get("ENDPOINT") %}
11
13
< li > < a href ='/call_downstream_api '> Call a downstream API</ a > </ li >
12
14
{% endif %}
@@ -16,6 +18,8 @@ <h2>Welcome {{ user.get("name") }}!</h2>
16
18
{% endif %}
17
19
18
20
< li > < a href ="/logout "> Logout</ a > </ li >
21
+ </ ul >
22
+
19
23
< hr >
20
24
< footer style ="text-align: right "> Powered by Identity Web {{ version }}</ footer >
21
25
</ body >
Original file line number Diff line number Diff line change 2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
+ < title > Microsoft Identity Python Web App: Login</ title >
5
6
</ head >
6
7
< body >
7
8
< h1 > Microsoft Identity Python Web App</ h1 >
8
9
9
10
{% if user_code %}
10
11
< ol >
11
- < li > To sign in, type < b > {{ user_code }}</ b > into
12
- < a href ='{{ auth_uri }} ' target =_blank > {{ auth_uri }}</ a >
13
- to authenticate.
14
- </ li >
15
- < li > And then < a href ="{{ url_for('auth_response') }} "> proceed</ a > .</ li >
12
+ < li > To sign in, type < b > {{ user_code }}</ b > into
13
+ < a href ='{{ auth_uri }} ' target =_blank > {{ auth_uri }}</ a >
14
+ to authenticate.
15
+ </ li >
16
+ < li > And then < a href ="{{ url_for('auth_response') }} "> proceed</ a > .</ li >
16
17
</ ol >
17
18
{% else %}
18
- < li > < a href ='{{ auth_uri }} '> Sign In</ a > </ li >
19
+ < ul > < li > < a href ='{{ auth_uri }} '> Sign In</ a > </ li > </ ul >
19
20
{% endif %}
20
21
21
22
{% if config.get("B2C_RESET_PASSWORD_AUTHORITY") %}
22
- < li > < a href ="{{config.get('B2C_RESET_PASSWORD_AUTHORITY')}}?client_id={{config.get('CLIENT_ID')}} "> Reset Password</ a > </ li >
23
+ < a href ="{{config.get('B2C_RESET_PASSWORD_AUTHORITY')}}?client_id={{config.get('CLIENT_ID')}} "> Reset Password</ a >
23
24
{% endif %}
24
25
25
26
< hr >
You can’t perform that action at this time.
0 commit comments