Skip to content

Commit 1d7ff24

Browse files
update example
1 parent 5a8f73a commit 1d7ff24

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

articles/static-web-apps/authentication-authorization.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,23 @@ For example:
7070
<a href="/.auth/login/github?post_login_redirect_uri=https://zealous-water.azurestaticapps.net/success">Login</a>
7171
```
7272

73-
Alternatively, if you want to redirect back to the referring page, you can use the `.referrer` token.
73+
Additionally, you can redirect unauthenticated users back to the referring page after they log in. To configure this behavior, create a [response override](configuration.md#response-overrides) rule that sets `post_login_redirect_uri` to `.referrer`.
7474

7575
For example:
7676

77-
```html
78-
<a href="/.auth/login/github?post_login_redirect_uri=.referrer">Login</a>
77+
```json
78+
{
79+
"responseOverrides": {
80+
"401": {
81+
"redirect": "/.auth/login/<PROVIDER>?post_login_redirect_uri=.referrer",
82+
"statusCode": 302
83+
}
84+
}
85+
}
7986
```
8087

88+
As you use this code example, make sure to replace `<PROVIDER>` with the appropriate provider identifier.
89+
8190
## Logout
8291

8392
The `/.auth/logout` route logs users out from the website. You can add a link to your site navigation to allow the user to log out as shown in the following example.

0 commit comments

Comments
 (0)