diff --git a/.github/ISSUE_TEMPLATE/2_bug_provider.yml b/.github/ISSUE_TEMPLATE/2_bug_provider.yml index a63162241b..60976c1a69 100644 --- a/.github/ISSUE_TEMPLATE/2_bug_provider.yml +++ b/.github/ISSUE_TEMPLATE/2_bug_provider.yml @@ -29,6 +29,7 @@ body: - "Atlassian" - "Auth0" - "Authentik" + - "Authgear" - "Azure Active Directory" - "Azure Active Directory B2C" - "Azure DevOps" diff --git a/docs/public/img/providers/authgear.svg b/docs/public/img/providers/authgear.svg new file mode 100644 index 0000000000..fcf7edfd03 --- /dev/null +++ b/docs/public/img/providers/authgear.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/providers/authgear.ts b/packages/core/src/providers/authgear.ts new file mode 100644 index 0000000000..b15a88d340 --- /dev/null +++ b/packages/core/src/providers/authgear.ts @@ -0,0 +1,81 @@ +/** + *
+ * Built-in Authgear integration. + * + * + * + *
+ * + * @module providers/authgear + */ +import type { OAuthConfig, OAuthUserConfig } from "./index.js" + +export interface AuthgearProfile extends Record { + sub: string + name: string + email: string + picture: string +} + +/** + * Add Authgear login to your page. + * + * ### Setup + * + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/authgear + * ``` + * + * #### Configuration + *```ts + * import { Auth } from "@auth/core" + * import Authgear from "@auth/core/providers/authgear" + * + * const request = new Request(origin) + * const response = await Auth(request, { + * providers: [ + * Authgear({ + * clientId: YOUR_AUTHGEAR_CLIENT_ID, + * clientSecret: YOUR_AUTHGEAR_CLIENT_SECRET, + * issuer: YOUR_AUTHGEAR_ISSUER_OR_PROJECT_ENDPOINT, + * client: { + token_endpoint_auth_method: "client_secret_post", + } + * }), + * ], + * }) + * ``` + * + * ### Resources + * + * - [Authgear OAuth documentation](https://docs.authgear.com/get-started/regular-web-app) + * + * :::tip + * + * The Authgear provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/authgear.ts). + * To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/configuring-oauth-providers). + * + * ::: + * + * :::info **Disclaimer** + * + * If you think you found a bug in the default configuration, you can [open an issue](https://authjs.dev/new/provider-issue). + * + * Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from + * the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, + * we might not pursue a resolution. You can ask for more help in [Discussions](https://authjs.dev/new/github-discussions). + * + * ::: + */ +export default function Authgear

( + options: OAuthUserConfig

+): OAuthConfig

{ + return { + id: "authgear", + name: "Authgear", + type: "oidc", + style: { bg: "#000", text: "#fff" }, + options, + } +}