Skip to content

Commit 6ee6631

Browse files
committed
GH-17: Add "Access token" section in docs
1 parent 2149db0 commit 6ee6631

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

docs/references/tutorials.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,35 @@ generated the client ID and secret to configure your `OAuth2Middleware` with at
2828
Once the authentication is successful, the user will be redirected to the `redirect_uri` and the `request.user` will
2929
contain the user information obtained from the IDP.
3030

31+
## Access token
32+
33+
When the user is authenticated, the `request.user` will contain the user information obtained from the IDP and
34+
the `request.auth` will contain the authentication related information including the access token issued by the IDP. It
35+
can be used to perform authorized requests to the IDP's API endpoints. Just make sure the token is issued with the
36+
scopes required for the API endpoint.
37+
38+
::: details `request.auth.provider.access_token`
39+
40+
```mermaid
41+
flowchart TB
42+
subgraph level2["request (Starlette's Request object)"]
43+
direction TB
44+
subgraph level1["auth (Starlette's extended Auth Credentials)"]
45+
direction TB
46+
subgraph level0["provider (OAuth2 provider with client's credentials)"]
47+
direction TB
48+
token["access_token (Access token for the specified scopes)"]
49+
end
50+
end
51+
end
52+
style level2 fill:#00948680,color:#f6f6f7,stroke:#3c3c43;
53+
style level1 fill:#2b75a080,color:#f6f6f7,stroke:#3c3c43;
54+
style level0 fill:#5c837480,color:#f6f6f7,stroke:#3c3c43;
55+
style token fill:#44506980,color:#f6f6f7,stroke:#3c3c43;
56+
```
57+
58+
:::
59+
3160
## Claims mapping
3261

3362
The `Claims` class includes permanent attributes like `display_name`, `identity`, `picture`, and `email`. It also allows
@@ -105,7 +134,7 @@ calculating the `identity` attribute.
105134
:::
106135

107136
<style>
108-
.info {
137+
.info, .details {
109138
border: 0;
110139
}
111140
</style>

0 commit comments

Comments
 (0)