-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): Add United Effects provider (#4546)
* Adding United Effects as a provider * Update packages/next-auth/src/providers/united-effects.ts * returning name and image as null in profile response Co-authored-by: Lluis Agusti <hi@llu.lu>
- Loading branch information
Showing
2 changed files
with
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
id: united-effects | ||
title: United Effects | ||
--- | ||
|
||
## Documentation | ||
|
||
https://docs.unitedeffects.com/integrations/nextauthjs | ||
|
||
## Configuration | ||
|
||
https://core.unitedeffects.com | ||
|
||
## Options | ||
|
||
The **United Effects Provider** comes with a set of default options: | ||
|
||
- [United Effects Provider options](https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/providers/united-effects.ts) | ||
|
||
You can override any of the options to suit your own use case. | ||
|
||
## Example | ||
|
||
```js | ||
import UnitedEffectsProvider from "next-auth/providers/united-effects"; | ||
... | ||
providers: [ | ||
UnitedEffectsProvider({ | ||
clientId: process.env.UNITED_EFFECTS_CLIENT_ID, | ||
clientSecret: process.env.UNITED_EFFECTS_CLIENT_SECRET, | ||
issuer: process.env.UNITED_EFFECTS_ISSUER | ||
}) | ||
] | ||
... | ||
``` | ||
|
||
:::note | ||
`issuer` should be the fully qualified URL including your Auth Group ID – e.g. `https://auth.unitedeffects.com/YQpbQV5dbW-224dCovz-3` | ||
::: | ||
|
||
:::warning | ||
The United Effects API does not return the user name or image by design, so this provider will return null for both. United Effects prioritizes user personal information security above all and has built a secured profile access request system separate from the provider API. | ||
::: |
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,31 @@ | ||
import type { OAuthConfig, OAuthUserConfig } from "." | ||
|
||
export interface UnitedEffectsProfile extends Record<string, any> { | ||
sub: string | ||
email: string | ||
} | ||
|
||
export default function UnitedEffects<P extends UnitedEffectsProfile>( | ||
options: OAuthUserConfig<P> & { issuer: string } | ||
): OAuthConfig<P> { | ||
return { | ||
id: "united-effects", | ||
name: "United Effects", | ||
wellKnown: `${options.issuer}/.well-known/openid-configuration`, | ||
type: "oauth", | ||
authorization: { | ||
params: { scope: "openid email profile", resource: options.issuer }, | ||
}, | ||
checks: ["pkce", "state"], | ||
idToken: true, | ||
profile(profile) { | ||
return { | ||
id: profile.sub, | ||
name: null, | ||
email: profile.email, | ||
image: null, | ||
} | ||
}, | ||
options, | ||
} | ||
} |
81afeef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
next-auth – ./
www.next-auth.js.org
next-auth-phi-two.vercel.app
next-auth-git-main-nextauthjs.vercel.app
next-auth.js.org
next-auth-nextauthjs.vercel.app