Skip to content

Commit 0510ace

Browse files
authored
Merge pull request #189938 from craigshoemaker/swa/referrer
[Static Web Apps] add .referrer token
2 parents 381f1ad + 92498f7 commit 0510ace

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

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

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`.
74+
75+
For example:
76+
77+
```json
78+
{
79+
"responseOverrides": {
80+
"401": {
81+
"redirect": "/.auth/login/github?post_login_redirect_uri=.referrer",
82+
"statusCode": 302
83+
}
84+
}
85+
}
86+
```
87+
7388
## Logout
7489

7590
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)