Skip to content

Commit d6d7a90

Browse files
committed
More docs on how to setup Redirect URI
This can reduce the misunderstanding which drove audience to use low-level API.
1 parent 55f10aa commit d6d7a90

File tree

5 files changed

+55
-4
lines changed

5 files changed

+55
-4
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This Identity library is an authentication/authorization library that:
3030
</tr>
3131

3232
<tr>
33-
<th>App Registration</th>
33+
<th rowspan=2>App Registration</th>
3434
<td><!-- See https://github.com/github/cmark-gfm/issues/12 -->
3535

3636
Following only the step 1, 2 and 3 of this
@@ -55,6 +55,26 @@ Following only the step 1 and 2 (including 2.1 and 2.2) of this
5555
</td>
5656
</tr>
5757

58+
<tr>
59+
<td colspan=4>
60+
After app registration, you shall obtain the following information:
61+
62+
* Your app's `client_id`, also known as application ID.
63+
(For example, if you are using Entra ID, you may follow this
64+
[app registration document](https://learn.microsoft.com/entra/identity-platform/quickstart-register-app)).
65+
* Your app's credential, which can either be a secret string, or a certificate.
66+
(For example, if you are using Entra ID, you may follow this
67+
[app credential document](https://learn.microsoft.com/entra/identity-platform/how-to-add-credentials?tabs=client-secret)).
68+
The `Identity` library's `client_credential` parameter supports all formats supported by
69+
[`msal` library's same name parameter](https://msal-python.readthedocs.io/en/latest/#msal.ClientApplication.params.client_credential).
70+
* Your app's Redirect URI.
71+
You may prepare two, one of them looks like `http://localhost:5000/redirect` for local development,
72+
the other looks like `https://your_website.com/redirect` for your production.
73+
(For example, if you are using Entra ID, you may follow this
74+
[redirect URI document](https://learn.microsoft.com/entra/identity-platform/how-to-add-redirect-uri)).
75+
</td>
76+
</tr>
77+
5878
<tr>
5979
<th>Web App Sign In & Sign Out</th>
6080
<td colspan=4>

docs/django.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,17 @@ Configuration
3535
from identity.django import Auth
3636
load_dotenv()
3737
AUTH = Auth(
38+
# Instruction for these settings is available in this project's README file.
39+
# https://github.com/rayluo/identity?tab=readme-ov-file#scenarios-supported
3840
os.getenv('CLIENT_ID'),
3941
client_credential=os.getenv('CLIENT_SECRET'),
40-
redirect_uri=os.getenv('REDIRECT_URI'),
42+
redirect_uri=
43+
# Recommended to register and use a redirect_uri.
44+
# It looks like http://localhost:5000/redirect for local development,
45+
# or https://your_website.com/redirect for your production.
46+
# If absent, Identity library will fall back to a Device Code mode.
47+
os.getenv('REDIRECT_URI'),
48+
4149
..., # See below on how to feed in the authority url parameter
4250
)
4351

docs/flask.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,18 @@ Configuration
4040

4141
auth = Auth(
4242
app,
43+
44+
# Instruction for these settings is available in this project's README file.
45+
# https://github.com/rayluo/identity?tab=readme-ov-file#scenarios-supported
4346
os.getenv('CLIENT_ID'),
4447
client_credential=os.getenv('CLIENT_SECRET'),
45-
redirect_uri=os.getenv('REDIRECT_URI'),
48+
redirect_uri=
49+
# Recommended to register and use a redirect_uri.
50+
# It looks like http://localhost:5000/redirect for local development,
51+
# or https://your_website.com/redirect for your production.
52+
# If absent, Identity library will fall back to a Device Code mode.
53+
os.getenv('REDIRECT_URI'),
54+
4655
..., # See below on how to feed in the authority url parameter
4756
)
4857

docs/quart.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ Configuration
2525

2626
auth = Auth(
2727
app,
28+
29+
# Instruction for these settings is available in this project's README file.
30+
# https://github.com/rayluo/identity?tab=readme-ov-file#scenarios-supported
2831
os.getenv('CLIENT_ID'),
2932
client_credential=os.getenv('CLIENT_SECRET'),
30-
redirect_uri=os.getenv('REDIRECT_URI'),
33+
redirect_uri=
34+
# Recommended to register and use a redirect_uri.
35+
# It looks like http://localhost:5000/redirect for local development,
36+
# or https://your_website.com/redirect for your production.
37+
# If absent, Identity library will fall back to a Device Code mode.
38+
os.getenv('REDIRECT_URI'),
39+
3140
..., # See below on how to feed in the authority url parameter
3241
)
3342

tox.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ commands =
2525
mypy --install-types --non-interactive
2626
mypy {[tox]x_project_name}
2727

28+
[testenv:docs]
29+
deps =
30+
-r docs/requirements.txt
31+
commands =
32+
sphinx-build docs docs/_build

0 commit comments

Comments
 (0)