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 11# Note: If you are using Azure App Service, go to your app's Configuration,
22# and then set the following values into your app's "Application settings".
33
4- FLASK_DEBUG = True
4+ CLIENT_ID = <client id>
5+ CLIENT_SECRET = <client secret>
6+
57# Expects a full tenant id such as "contoso.onmicrosoft.com", or its GUID
68# Or leave it undefined if you are building a multi-tenant app
79# TENANT_ID=<tenant id>
8- CLIENT_ID = <client id>
9- CLIENT_SECRET = <client secret>
Original file line number Diff line number Diff line change 11# Note: If you are using Azure App Service, go to your app's Configuration,
22# 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>
73CLIENT_ID=<client id>
84CLIENT_SECRET=<client secret>
5+ # Expects the display name such as "contoso"
6+ TENANT_NAME=<tenant name>
97SIGNUPSIGNIN_USER_FLOW=B2C_1_profile_editing
108EDITPROFILE_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
3232 will be automatically created with the shape as ` your_app_name\$your_app_name ` .
3333 But your actual git username is only the ` $your_app_name ` part.
3434
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 ) .
4036
4137
4238## Contributing
Original file line number Diff line number Diff line change @@ -51,10 +51,7 @@ def index():
5151 if not (app .config ["CLIENT_ID" ] and app .config ["CLIENT_SECRET" ]):
5252 # This check is not strictly necessary.
5353 # 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' )
5855 if not auth .get_user ():
5956 return redirect (url_for ("login" ))
6057 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
23# If Flask-Session is not maintained in future, Flask-Session2 should work as well
34Flask-Session >= 0.3.2 ,< 0.5
45werkzeug >= 2
Original file line number Diff line number Diff line change 22< html lang ="en ">
33< head >
44 < meta charset ="UTF-8 ">
5-
65 {% if config.get("B2C_RESET_PASSWORD_AUTHORITY") and "AADB2C90118" in result.get("error_description") %} <!-- This will be reached when user forgot their password -->
76 <!-- See also https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-policies#linking-user-flows -->
87 < meta http-equiv ="refresh " content ='0;{{config.get("B2C_RESET_PASSWORD_AUTHORITY")}}?client_id={{config.get("CLIENT_ID")}} '>
98 {% endif %}
9+ < title > Microsoft Identity Python Web App: Error</ title >
1010</ head >
1111< body >
1212 < h2 > Login Failure</ h2 >
@@ -18,4 +18,3 @@ <h2>Login Failure</h2>
1818 < a href ="{{ url_for('index') }} "> Homepage</ a >
1919</ body >
2020</ 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 22< html lang ="en ">
33< head >
44 < meta charset ="UTF-8 ">
5+ < title > Microsoft Identity Python Web App: API</ title >
56</ head >
67< body >
78 < 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 22< html lang ="en ">
33< head >
44 < meta charset ="UTF-8 ">
5+ < title > Microsoft Identity Python Web App: Index</ title >
56</ head >
67< body >
78 < h1 > Microsoft Identity Python Web App</ h1 >
89 < h2 > Welcome {{ user.get("name") }}!</ h2 >
910
11+ < ul >
1012 {% if config.get("ENDPOINT") %}
1113 < li > < a href ='/call_downstream_api '> Call a downstream API</ a > </ li >
1214 {% endif %}
@@ -16,6 +18,8 @@ <h2>Welcome {{ user.get("name") }}!</h2>
1618 {% endif %}
1719
1820 < li > < a href ="/logout "> Logout</ a > </ li >
21+ </ ul >
22+
1923 < hr >
2024 < footer style ="text-align: right "> Powered by Identity Web {{ version }}</ footer >
2125</ body >
Original file line number Diff line number Diff line change 22< html lang ="en ">
33< head >
44 < meta charset ="UTF-8 ">
5+ < title > Microsoft Identity Python Web App: Login</ title >
56</ head >
67< body >
78 < h1 > Microsoft Identity Python Web App</ h1 >
89
910 {% if user_code %}
1011 < 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 >
1617 </ ol >
1718 {% else %}
18- < li > < a href ='{{ auth_uri }} '> Sign In</ a > </ li >
19+ < ul > < li > < a href ='{{ auth_uri }} '> Sign In</ a > </ li > </ ul >
1920 {% endif %}
2021
2122 {% 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 >
2324 {% endif %}
2425
2526 < hr >
You can’t perform that action at this time.
0 commit comments