Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** @type {import("types/providers").OAuthProvider} */ | ||
export default function Keycloak(options) { | ||
return { | ||
id: "keycloak", | ||
name: "Keycloak", | ||
wellKnown: `${options.issuer}/.well-known/openid-configuration`, | ||
type: "oauth", | ||
authorization: { params: { scope: "openid email profile" } }, | ||
checks: ["pkce", "state"], | ||
idToken: true, | ||
profile(profile) { | ||
return { | ||
id: profile.sub, | ||
name: profile.name, | ||
email: profile.email, | ||
} | ||
}, | ||
options, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
id: keycloak | ||
title: Keycloak | ||
--- | ||
|
||
## Documentation | ||
|
||
https://www.keycloak.org/docs/latest/server_admin/#_oidc_clients | ||
|
||
## Configuration | ||
|
||
:::tip | ||
Create an openid-connect client in Keycloak with "confidential" as the "Access Type". | ||
::: | ||
|
||
## Options | ||
|
||
The **Keycloak Provider** comes with a set of default options: | ||
|
||
- [Keycloak Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/keycloak.js) | ||
|
||
You can override any of the options to suit your own use case. | ||
|
||
## Example | ||
|
||
```js | ||
import Providers from `next-auth/providers` | ||
... | ||
providers: [ | ||
Providers.Keycloak({ | ||
clientId: process.env.KEYCLOAK_ID, | ||
clientSecret: process.env.KEYCLOAK_SECRET, | ||
issuer: process.env.KEYCLOAK_ISSUER, | ||
}) | ||
] | ||
... | ||
``` | ||
|
||
:::note | ||
`issuer` should include the realm – e.g. `https://my-keycloak-domain.com/auth/realms/My_Realm` | ||
::: |