Skip to content

Commit 81afeef

Browse files
cbetz0ubbe
andauthoredJun 3, 2022
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>
1 parent 008f29e commit 81afeef

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
 

‎docs/docs/providers/united-effects.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
id: united-effects
3+
title: United Effects
4+
---
5+
6+
## Documentation
7+
8+
https://docs.unitedeffects.com/integrations/nextauthjs
9+
10+
## Configuration
11+
12+
https://core.unitedeffects.com
13+
14+
## Options
15+
16+
The **United Effects Provider** comes with a set of default options:
17+
18+
- [United Effects Provider options](https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/providers/united-effects.ts)
19+
20+
You can override any of the options to suit your own use case.
21+
22+
## Example
23+
24+
```js
25+
import UnitedEffectsProvider from "next-auth/providers/united-effects";
26+
...
27+
providers: [
28+
UnitedEffectsProvider({
29+
clientId: process.env.UNITED_EFFECTS_CLIENT_ID,
30+
clientSecret: process.env.UNITED_EFFECTS_CLIENT_SECRET,
31+
issuer: process.env.UNITED_EFFECTS_ISSUER
32+
})
33+
]
34+
...
35+
```
36+
37+
:::note
38+
`issuer` should be the fully qualified URL including your Auth Group ID – e.g. `https://auth.unitedeffects.com/YQpbQV5dbW-224dCovz-3`
39+
:::
40+
41+
:::warning
42+
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.
43+
:::
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { OAuthConfig, OAuthUserConfig } from "."
2+
3+
export interface UnitedEffectsProfile extends Record<string, any> {
4+
sub: string
5+
email: string
6+
}
7+
8+
export default function UnitedEffects<P extends UnitedEffectsProfile>(
9+
options: OAuthUserConfig<P> & { issuer: string }
10+
): OAuthConfig<P> {
11+
return {
12+
id: "united-effects",
13+
name: "United Effects",
14+
wellKnown: `${options.issuer}/.well-known/openid-configuration`,
15+
type: "oauth",
16+
authorization: {
17+
params: { scope: "openid email profile", resource: options.issuer },
18+
},
19+
checks: ["pkce", "state"],
20+
idToken: true,
21+
profile(profile) {
22+
return {
23+
id: profile.sub,
24+
name: null,
25+
email: profile.email,
26+
image: null,
27+
}
28+
},
29+
options,
30+
}
31+
}

1 commit comments

Comments
 (1)
Please sign in to comment.