You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/app-service-authentication-how-to.md
+46-2Lines changed: 46 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,9 @@ To get started quickly, see one of the following tutorials:
30
30
*[How to configure your app to use Microsoft Account login](app-service-mobile-how-to-configure-microsoft-authentication.md)
31
31
*[How to configure your app to use Twitter login](app-service-mobile-how-to-configure-twitter-authentication.md)
32
32
33
-
## Configure multiple sign-in options
33
+
## Use multiple sign-in providers
34
34
35
-
The portal configuration doesn't offer a turn-key way to present multiple sign-in options to your users (such as both Facebook and Twitter). However, it isn't difficult to add the functionality to your web app. The steps are outlined as follows:
35
+
The portal configuration doesn't offer a turn-key way to present multiple sign-in providers to your users (such as both Facebook and Twitter). However, it isn't difficult to add the functionality to your web app. The steps are outlined as follows:
36
36
37
37
First, in the **Authentication / Authorization** page in the Azure portal, configure each of the identity provider you want to enable.
38
38
@@ -56,6 +56,50 @@ To redirect the user post-sign-in to a custom URL, use the `post_login_redirect_
Users can initiate a sign-out by sending a `GET` request to the app's `/.auth/logout` endpoint. The `GET` request does the following:
62
+
63
+
- Clears authentication cookies from the current session.
64
+
- Deletes the current user's tokens from the token store.
65
+
- For Azure Active Directory and Google, performs a server-side sign-out on the identity provider.
66
+
67
+
Here's a simple sign-out link in a webpage:
68
+
69
+
```HTML
70
+
<ahref="/.auth/logout">Sign out</a>
71
+
```
72
+
73
+
By default, a successful sign-out redirects the client to the URL `/.auth/logout/done`. You can change the post-sign-out redirect page by adding the `post_logout_redirect_uri` query parameter. For example:
74
+
75
+
```
76
+
GET /.auth/logout?post_logout_redirect_uri=/index.html
77
+
```
78
+
79
+
It's recommended that you [encode](https://wikipedia.org/wiki/Percent-encoding) the value of `post_logout_redirect_uri`.
80
+
81
+
When using fully qualified URLs, the URL must be either hosted in the same domain or configured as an allowed external redirect URL for your app. In the following example, to redirect to `https://myexternalurl.com` that's not hosted in the same domain:
82
+
83
+
```
84
+
GET /.auth/logout?post_logout_redirect_uri=https%3A%2F%2Fmyexternalurl.com
85
+
```
86
+
87
+
You must run the following command in the [Azure Cloud Shell](../cloud-shell/quickstart.md):
88
+
89
+
```azurecli-interactive
90
+
az webapp auth update --name <app_name> --resource-group <group_name> --allowed-external-redirect-urls "https://myexternalurl.com"
91
+
```
92
+
93
+
## Preserve URL fragments
94
+
95
+
After users sign in to your app, they usually want to be redirected to the same section of the same page, such as `/wiki/Main_Page#SectionZ`. However, because [URL fragments](https://wikipedia.org/wiki/Fragment_identifier) (for example, `#SectionZ`) are never sent to the server, they are not preserved by default after the OAuth sign-in completes and redirects back to your app. Users then get a suboptimal experience when they need to navigate to the desired anchor again. This limitation applies to all server-side authentication solutions.
96
+
97
+
In App Service authentication, you can preserve URL fragments across the OAuth sign-in. To do this, set an app setting called `WEBSITE_AUTH_PRESERVE_URL_FRAGMENT` to `true`. You can do it in the [Azure portal](https://portal.azure.com), or simply run the following command in the [Azure Cloud Shell](../cloud-shell/quickstart.md):
98
+
99
+
```azurecli-interactive
100
+
az webapp config appsettings set --name <app_name> --resource-group <group_name> --settings WEBSITE_AUTH_PRESERVE_URL_FRAGMENT="true"
101
+
```
102
+
59
103
## Access user claims
60
104
61
105
App Service passes user claims to your application by using special headers. External requests aren't allowed to set these headers, so they are present only if set by App Service. Some example headers include:
Copy file name to clipboardExpand all lines: articles/app-service/app-service-authentication-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,7 +131,7 @@ With this option, you don't need to write any authentication code in your app. F
131
131
132
132
The option is **Allow Anonymous requests**. This option turns on authentication and authorization in App Service, but defers authorization decisions to your application code. For authenticated requests, App Service also passes along authentication information in the HTTP headers.
133
133
134
-
This option provides more flexibility in handling anonymous requests. For example, it lets you [present multiple sign-in options](app-service-authentication-how-to.md#configure-multiple-sign-in-options) to your users. However, you have to write code.
134
+
This option provides more flexibility in handling anonymous requests. For example, it lets you [present multiple sign-in providers](app-service-authentication-how-to.md#use-multiple-sign-in-providers) to your users. However, you must write code.
0 commit comments