Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/2_bug_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ body:
- "Osso"
- "Osu"
- "Patreon"
- "Paybin"
- "Ping Identity"
- "Pipedrive"
- "Reddit"
Expand Down
1 change: 1 addition & 0 deletions docs/pages/data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"osu": "Osu!",
"passage": "Passage",
"patreon": "Patreon",
"paybin": "Paybin",
"pinterest": "Pinterest",
"pipedrive": "Pipedrive",
"reddit": "Reddit",
Expand Down
83 changes: 83 additions & 0 deletions docs/pages/getting-started/providers/paybin.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Callout } from "nextra/components"
import { Code } from "@/components/Code"

<img align="right" src="/img/providers/paybin.svg" width="64" height="64" />

# 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

<Code>
<Code.Next>

```bash
https://example.com/api/auth/callback/paybin
```

</Code.Next>
<Code.Svelte>

```bash
https://example.com/auth/callback/paybin
```

</Code.Svelte>
</Code>

### Environment Variables

```
AUTH_PAYBIN_ID
AUTH_PAYBIN_SECRET
```

### Configuration

<Code>
<Code.Next>

```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],
})
```

</Code.Next>
<Code.Svelte>

```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],
})
```

</Code.Svelte>
<Code.Express>

```ts filename="/src/app.ts"
import { ExpressAuth } from "@auth/express"
import Paybin from "@auth/express/providers/paybin"

app.use("/auth/*", ExpressAuth({ providers: [Paybin] }))
```

</Code.Express>
</Code>

<Callout>
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.
</Callout>
21 changes: 21 additions & 0 deletions docs/public/img/providers/paybin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions packages/core/src/providers/paybin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* <div class="provider" style={{display: "flex", justifyContent: "space-between", alignItems: "center"}}>
* <span style={{fontSize: "1.35rem" }}>
* Built-in sign in with <b>Paybin</b> integration.
* </span>
* <a href="https://paybin.io" style={{backgroundColor: "#000", padding: "12px", borderRadius: "100%" }}>
* <img style={{display: "block"}} src="https://authjs.dev/img/providers/paybin.svg" width="24"/>
* </a>
* </div>
*
* @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<string, any> {
/** 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<P extends PaybinProfile>(
options: OIDCUserConfig<P>
): OIDCConfig<P> {
return {
id: "paybin",
name: "Paybin",
type: "oidc",
issuer: "https://idp.paybin.io",
style: { text: "#fff", bg: "#000" },
options,
}
}