Paybin
Get your Paybin credentials
To use Paybin sign in, you need to create an OAuth 2.0 Client through your Paybin Portfolio application.
-
Log in to your Paybin Portfolio
-
Navigate to Developer Settings or OAuth Applications section
-
Click "Create OAuth Application" or "New Application"
-
Fill in the required fields:
- Application Name: The name shown to users during authorization
- Redirect URIs: Set to
http://localhost:3000/api/auth/callback/paybinfor local development. For production, set it tohttps://yourdomain.com/api/auth/callback/paybin. If you change the base path of the auth routes, update the redirect URI accordingly.
-
After creation, copy the Client ID and Client Secret to your environment variables. Keep these credentials secure.
Configure the provider
To configure the provider, you need to import the provider and pass it to the socialProviders option of the auth instance.
import { betterAuth } from "better-auth"
export const auth = betterAuth({
socialProviders: {
paybin: {
clientId: process.env.PAYBIN_CLIENT_ID as string,
clientSecret: process.env.PAYBIN_CLIENT_SECRET as string,
},
},
})Sign In with Paybin
To sign in with Paybin, you can use the signIn.social function provided by the client, where the provider should be set to paybin.
import { createAuthClient } from "better-auth/client"
const authClient = createAuthClient()
const signIn = async () => {
const data = await authClient.signIn.social({
provider: "paybin"
})
}Additional Configuration
Scopes
By default, Paybin provider requests the following scopes: openid, email, and profile. You can customize the scopes based on your application's needs.
For a complete list of available scopes and their descriptions, see the Paybin OIDC Scopes Documentation.
export const auth = betterAuth({
socialProviders: {
paybin: {
clientId: process.env.PAYBIN_CLIENT_ID as string,
clientSecret: process.env.PAYBIN_CLIENT_SECRET as string,
scope: ["openid", "email", "profile", "transactions"],
},
},
})User Profile Mapping
Paybin returns user information in the ID token following OpenID Connect standards. The provider automatically extracts:
idfromsubclaimnamefromname,preferred_username, oremail(in order of preference)emailfromemailclaimimagefrompictureclaimemailVerifiedfromemail_verifiedclaim