diff --git a/.github/ISSUE_TEMPLATE/2_bug_provider.yml b/.github/ISSUE_TEMPLATE/2_bug_provider.yml index 1ee4409a23..9d079ec97b 100644 --- a/.github/ISSUE_TEMPLATE/2_bug_provider.yml +++ b/.github/ISSUE_TEMPLATE/2_bug_provider.yml @@ -82,6 +82,7 @@ body: - "Osso" - "Osu" - "Patreon" + - "Paybin" - "Ping Identity" - "Pipedrive" - "Reddit" diff --git a/docs/pages/data/manifest.json b/docs/pages/data/manifest.json index 7fef03e029..3fcc9ca85b 100644 --- a/docs/pages/data/manifest.json +++ b/docs/pages/data/manifest.json @@ -102,6 +102,7 @@ "osu": "Osu!", "passage": "Passage", "patreon": "Patreon", + "paybin": "Paybin", "pinterest": "Pinterest", "pipedrive": "Pipedrive", "reddit": "Reddit", diff --git a/docs/pages/getting-started/providers/paybin.mdx b/docs/pages/getting-started/providers/paybin.mdx new file mode 100644 index 0000000000..a4f4d4f280 --- /dev/null +++ b/docs/pages/getting-started/providers/paybin.mdx @@ -0,0 +1,83 @@ +import { Callout } from "nextra/components" +import { Code } from "@/components/Code" + + + +# Paybin Provider + +## Resources + +- [Paybin OAuth documentation](https://paybin.io/docs/oauth) +- [Paybin OIDC configuration](https://idp.paybin.io/.well-known/openid-configuration) + +## Setup + +### Callback URL + + + + + ```bash + https://example.com/api/auth/callback/paybin + ``` + + + + + ```bash + https://example.com/auth/callback/paybin + ``` + + + + +### Environment Variables + +``` +AUTH_PAYBIN_ID +AUTH_PAYBIN_SECRET +``` + +### Configuration + + + + +```ts filename="/auth.ts" +import NextAuth from "next-auth" +import Paybin from "next-auth/providers/paybin" + +export const { handlers, auth, signIn, signOut } = NextAuth({ + providers: [Paybin], +}) +``` + + + + +```ts filename="/src/auth.ts" +import { SvelteKitAuth } from "@auth/sveltekit" +import Paybin from "@auth/sveltekit/providers/paybin" + +export const { handle, signIn, signOut } = SvelteKitAuth({ + providers: [Paybin], +}) +``` + + + + +```ts filename="/src/app.ts" +import { ExpressAuth } from "@auth/express" +import Paybin from "@auth/express/providers/paybin" + +app.use("/auth/*", ExpressAuth({ providers: [Paybin] })) +``` + + + + + + By default, Auth.js assumes that the Paybin provider is based on the + [OIDC](https://openid.net/specs/openid-connect-core-1_0.html) specification. + diff --git a/docs/public/img/providers/paybin.svg b/docs/public/img/providers/paybin.svg new file mode 100644 index 0000000000..00961a48c3 --- /dev/null +++ b/docs/public/img/providers/paybin.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/core/src/providers/paybin.ts b/packages/core/src/providers/paybin.ts new file mode 100644 index 0000000000..5e56dd4703 --- /dev/null +++ b/packages/core/src/providers/paybin.ts @@ -0,0 +1,94 @@ +/** + *
+ * + * Built-in sign in with Paybin integration. + * + * + * + * + *
+ * + * @module providers/paybin + */ +import type { OIDCConfig, OIDCUserConfig } from "./index.js" + +/** + * The returned user profile from Paybin when using the profile callback. + * [Reference](https://idp.paybin.io/.well-known/openid-configuration) + */ +export interface PaybinProfile extends Record { + /** The user's unique identifier. */ + sub: string + /** The user's email address. */ + email: string + /** Indicates whether the user has verified their email address. */ + email_verified?: boolean + /** The user's full name. */ + name?: string + /** The user's username. */ + preferred_username?: string + /** URL pointing to the user's profile picture. */ + picture?: string + /** The user's given name. */ + given_name?: string + /** The user's family name. */ + family_name?: string +} + +/** + * ### Setup + * + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/paybin + * ``` + * + * #### Configuration + * ```ts + * import { Auth } from "@auth/core" + * import Paybin from "@auth/core/providers/paybin" + * + * const request = new Request(origin) + * const response = await Auth(request, { + * providers: [ + * Paybin({ + * clientId: PAYBIN_CLIENT_ID, + * clientSecret: PAYBIN_CLIENT_SECRET, + * }), + * ], + * }) + * ``` + * + * ### Resources + * + * - [Paybin OAuth documentation](https://developers.paybin.io/knowledge-center/oidc) + * - [Paybin OIDC configuration](https://idp.paybin.io/.well-known/openid-configuration) + * + * ### Notes + * + * By default, Auth.js assumes that the Paybin provider is + * based on the [Open ID Connect](https://openid.net/specs/openid-connect-core-1_0.html) specification. + * + * The Paybin provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/paybin.ts). + * To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/configuring-oauth-providers). + * + * ## Help + * + * 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 Paybin

( + options: OIDCUserConfig

+): OIDCConfig

{ + return { + id: "paybin", + name: "Paybin", + type: "oidc", + issuer: "https://idp.paybin.io", + style: { text: "#fff", bg: "#000" }, + options, + } +}