Skip to content

Commit

Permalink
feat(provider): Add United Effects provider (#4546)
Browse files Browse the repository at this point in the history
* 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
cbetz and ubbe-xyz committed Jun 3, 2022
1 parent 008f29e commit 81afeef
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/docs/providers/united-effects.md
@@ -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.
:::
31 changes: 31 additions & 0 deletions packages/next-auth/src/providers/united-effects.ts
@@ -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,
}
}

1 comment on commit 81afeef

@vercel
Copy link

@vercel vercel bot commented on 81afeef Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.