Skip to content

Commit e79f856

Browse files
committed
docs(provider): 📝 Added docs for Microsoft provider
1 parent 3f2519d commit e79f856

File tree

8 files changed

+143
-30
lines changed

8 files changed

+143
-30
lines changed

docs/content/2.provider/entra.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ icon: i-simple-icons-microsoftazure
1515
## Introduction
1616

1717
This provider is specifically preconfigured to be used with Entra ID or Entra External ID (successor of Azure AD B2C).
18-
If you just need a social login using a Microsoft Account, use the Microsoft provider.
18+
If you just need a social login using a Microsoft Account, use the [Microsoft provider](/provider/microsoft), which provides a simplified version for social login.
1919

2020
If you are requesting a token for an application registered in Entra ID (for example an API), you need to set the resource to the id of that app registration. You should also set the audience to that ID, so the token can be correctly validated.
2121

@@ -49,13 +49,13 @@ entra: {
4949
redirectUri: 'http://localhost:3000/auth/entra/callback',
5050
clientId: '',
5151
clientSecret: '',
52-
authorizationUrl: 'https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/authorize',
53-
tokenUrl: 'https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token',
52+
authorizationUrl: 'https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/authorize', // For Entra External ID, use https://TENANT_NAME.ciamlogin.com/TENANT_ID/oauth2/authorize
53+
tokenUrl: 'https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token', // For Entra External ID, use https://TENANT_NAME.ciamlogin.com/TENANT_ID/oauth2/token
5454
userNameClaim: 'unique_name',
5555
nonce: true,
5656
responseType: 'code id_token',
5757
scope: ['profile', 'openid', 'offline_access', 'email'],
58-
logoutUrl: '',
58+
logoutUrl: 'https://login.microsoftonline.com/TENANT_ID/oauth2/logout', // For Entra External ID, use https://TENANT_NAME.ciamlogin.com/TENANT_ID/oauth2/logout
5959
optionalClaims: ['unique_name', 'family_name', 'given_name', 'login_hint'],
6060
audience: '', // In case you need access to an App/API registered in Entra ID
6161
additionalAuthParameters: {

docs/content/2.provider/microsoft.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: Microsoft
3+
description: Microsoft provider documentation
4+
icon: i-simple-icons-microsoft
5+
---
6+
7+
## Feature/OIDC support
8+
9+
&nbsp; PKCE<br>
10+
&nbsp; Nonce<br>
11+
&nbsp; State<br>
12+
&nbsp; Access Token validation<br>
13+
&nbsp; ID Token validation<br>
14+
15+
## Introduction
16+
17+
This is the simplified Microsoft provider for social login with a Microsoft Account (MSA). You need access to the Azure portal (portal.azure.com) to configure an app registration and get the required properties.
18+
Learn how to creat an app registration [here](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=client-secret).
19+
Be sure that you select one of the bottom two options if you want persoanl Microsoft accounts to be able to login to your application:
20+
21+
::contentImage{src="/content/microsoft-accounttype.png" alt="Microsoft account types"}
22+
::
23+
24+
Choose 'Web' as the target platform under `Manage` -> `Authentication` -> `Platform configurations`
25+
26+
::contentImage{src="/content/microsoft-platform.png" alt="Microsoft Platform configurations"}
27+
::
28+
29+
This provider uses the predefined userInfo url `https://graph.microsoft.com/v1.0/me` to get user information for an account.
30+
31+
## Example Configurations
32+
33+
::callout{icon="i-carbon-warning-alt" color="amber"}
34+
Never store sensitive values like your client secret in your Nuxt config. Our recommendation is to inject at least client id and client secret via. environment variables.
35+
::
36+
37+
### Minimal
38+
39+
```typescript [nuxt.config.ts]
40+
entra: {
41+
redirectUri: 'http://localhost:3000/auth/microsoft/callback',
42+
clientId: '',
43+
clientSecret: '',
44+
},
45+
```
46+
47+
### Get user information
48+
49+
You can also add the `profile` or another OIDC common scope. `User.Read` as a delegated permission is configured by default in **API permissons**.
50+
51+
```typescript [nuxt.config.ts]
52+
entra: {
53+
redirectUri: 'http://localhost:3000/auth/microsoft/callback',
54+
clientId: '',
55+
clientSecret: '',
56+
responseType: 'code',
57+
scope: ['openid', 'User.Read'],
58+
},
59+
```
60+
61+
### Get additonal user information with ID token
62+
63+
To be able to use the ID token, make sure you have set the checkbox at **Manage** -> **Authentication** -> **Implicit grant and hybrid flows** -> `ID tokens (used for implicit and hybrid flows)`.
64+
To add additional claims you want to use, configure them on your app registration under **Manage** -> **Token configuration** and add them by using the `optionalClaims: ['name', 'preferred_username'],` parameter.
65+
The default setting is `optionalClaims: ['name', 'preferred_username'],`.
66+
67+
```typescript [nuxt.config.ts]
68+
entra: {
69+
redirectUri: 'http://localhost:3000/auth/microsoft/callback',
70+
clientId: '',
71+
clientSecret: '',
72+
responseType: 'code id_token',
73+
scope: ['openid', 'User.Read'],
74+
},
75+
```
76+
77+
### Offline access/refresh token
78+
79+
In order to get a refresh token, you need to add the "Microsoft Graph" delegated permission `offline_access` and add it to the scopes.
80+
**Manage** -> **API permissions** -> `Add a permission`
81+
82+
::contentImage{src="/content/microsoft-scopes.png" alt="Microsoft account types"}
83+
::
84+
85+
```typescript [nuxt.config.ts]
86+
entra: {
87+
redirectUri: 'http://localhost:3000/auth/microsoft/callback',
88+
clientId: '',
89+
clientSecret: '',
90+
responseType: 'code id_token',
91+
scope: ['openid', 'User.Read', 'offline_access'],
92+
},
93+
```
94+
95+
### Environment variables
96+
97+
Dotenv files are only for (local) development. Use a proper configuration management or injection system in production.
98+
99+
```ini [.env]
100+
NUXT_OIDC_PROVIDERS_MICROSOFT_CLIENT_SECRET=CLIENT_SECRET
101+
NUXT_OIDC_PROVIDERS_MICROSOFT_CLIENT_ID=CLIENT_ID
102+
```
103+
104+
## Provider specific parameters
105+
106+
| Option | Type | Default | Description |
107+
|---|---|---|---|
108+
| tenantId | `string` | - | Required. The tenant id is used to automatically configure the correct endpoint urls for the Microsoft provider to work. |
109+
| prompt | `string` | 'login' | Optional. Indicates the type of user interaction that is required. Valid values are `login`, `none`, `consent`, and `select_account`. Can be used in `additionalAuthParameters`, `additionalTokenParameters` or `additionalLogoutParameters`. |
110+
| loginHint | `string` | - | Optional. You can use this parameter to pre-fill the username and email address field of the sign-in page for the user. Apps can use this parameter during reauthentication, after already extracting the login_hint optional claim from an earlier sign-in. Can be used in `additionalAuthParameters`, `additionalTokenParameters` or `additionalLogoutParameters`. |
111+
| logoutHint | `string` | - | Optional. Enables sign-out to occur without prompting the user to select an account. To use logout_hint, enable the login_hint optional claim in your client application and use the value of the login_hint optional claim as the logout_hint parameter. Can be used in `additionalAuthParameters`, `additionalTokenParameters` or `additionalLogoutParameters`. |
112+
| domainHint | `string` | - | Optional. If included, the app skips the email-based discovery process that user goes through on the sign-in page, leading to a slightly more streamlined user experience. Can be used in `additionalAuthParameters`, `additionalTokenParameters` or `additionalLogoutParameters`. |

docs/content/2.provider/zitadel.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ zitadel: {
4444
Dotenv files are only for (local) development. Use a proper configuration management or injection system in production.
4545

4646
```ini [.env]
47-
47+
NUXT_OIDC_PROVIDERS_ZITADEL_CLIENT_ID=123456789012345678
48+
NUXT_OIDC_PROVIDERS_ZITADEL_BASE_URL=https://PROJECT.us1.zitadel.cloud/
4849
```

docs/content/7.configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default defineNuxtConfig({
7878
| exposeIdToken | `boolean` (optional) | `false` | Expose raw id token to the client within session object
7979
| callbackRedirectUrl | `string` (optional) | `/` | Set a custom redirect url to redirect to after a successful callback
8080
| allowedClientAuthParameters | `string[]` (optional) | `[]` | List of allowed client-side user-added query parameters for the auth request
81-
| sessionConfiguration | `ProviderSessionConfig` (optional) | `{}` | Session configuration overrides, see [session](#provider-session)
81+
| sessionConfiguration | `ProviderSessionConfig` (optional) | `{}` | Session configuration overrides, see [session](#provider-session-configuration)
8282

8383
### Global session configuration (session)
8484

24.9 KB
Loading
33.5 KB
Loading
56.3 KB
Loading

docs/staticwebapp.config.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"routes": [
3-
{
4-
"route": "/getting-started/installation",
5-
"rewrite": "/getting-started/installation/index.html"
6-
},
73
{
84
"route": "/provider/paypal",
95
"rewrite": "/provider/paypal/index.html"
106
},
7+
{
8+
"route": "/getting-started/installation",
9+
"rewrite": "/getting-started/installation/index.html"
10+
},
1111
{
1212
"route": "/provider/auth0",
1313
"rewrite": "/provider/auth0/index.html"
@@ -16,49 +16,45 @@
1616
"route": "/provider/keycloak",
1717
"rewrite": "/provider/keycloak/index.html"
1818
},
19-
{
20-
"route": "/provider/entra",
21-
"rewrite": "/provider/entra/index.html"
22-
},
2319
{
2420
"route": "/provider/zitadel",
2521
"rewrite": "/provider/zitadel/index.html"
2622
},
2723
{
28-
"route": "/provider/oidc",
29-
"rewrite": "/provider/oidc/index.html"
24+
"route": "/provider/entra",
25+
"rewrite": "/provider/entra/index.html"
3026
},
3127
{
3228
"route": "/provider/github",
3329
"rewrite": "/provider/github/index.html"
3430
},
3531
{
36-
"route": "/provider/aws-cognito",
37-
"rewrite": "/provider/aws-cognito/index.html"
32+
"route": "/provider/oidc",
33+
"rewrite": "/provider/oidc/index.html"
3834
},
3935
{
40-
"route": "/composable",
41-
"rewrite": "/composable/index.html"
36+
"route": "/provider/aws-cognito",
37+
"rewrite": "/provider/aws-cognito/index.html"
4238
},
4339
{
4440
"route": "/hooks",
4541
"rewrite": "/hooks/index.html"
4642
},
4743
{
48-
"route": "/configuration",
49-
"rewrite": "/configuration/index.html"
50-
},
51-
{
52-
"route": "/server-utils/session-management",
53-
"rewrite": "/server-utils/session-management/index.html"
44+
"route": "/server-utils/middleware",
45+
"rewrite": "/server-utils/middleware/index.html"
5446
},
5547
{
5648
"route": "/server-utils/oidc-handlers",
5749
"rewrite": "/server-utils/oidc-handlers/index.html"
5850
},
5951
{
60-
"route": "/server-utils/middleware",
61-
"rewrite": "/server-utils/middleware/index.html"
52+
"route": "/server-utils/session-management",
53+
"rewrite": "/server-utils/session-management/index.html"
54+
},
55+
{
56+
"route": "/configuration",
57+
"rewrite": "/configuration/index.html"
6258
},
6359
{
6460
"route": "/contributing",
@@ -73,13 +69,17 @@
7369
"rewrite": "/getting-started/security/index.html"
7470
},
7571
{
76-
"route": "/provider",
77-
"rewrite": "/provider/index.html"
72+
"route": "/composable",
73+
"rewrite": "/composable/index.html"
7874
},
7975
{
8076
"route": "/getting-started",
8177
"rewrite": "/getting-started/index.html"
8278
},
79+
{
80+
"route": "/provider",
81+
"rewrite": "/provider/index.html"
82+
},
8383
{
8484
"route": "/dev-mode",
8585
"rewrite": "/dev-mode/index.html"

0 commit comments

Comments
 (0)