Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(provider): add United Effects provider #4546

Merged
merged 6 commits into from Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/docs/providers/united-effects.md
@@ -0,0 +1,39 @@
---
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`
:::
29 changes: 29 additions & 0 deletions packages/next-auth/src/providers/united-effects.ts
@@ -0,0 +1,29 @@
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>
cbetz marked this conversation as resolved.
Show resolved Hide resolved
): 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,
email: profile.email,
}
ubbe-xyz marked this conversation as resolved.
Show resolved Hide resolved
},
options,
}
}