@webstad/vipps-oauth-plugin
v1.0.2
Published
A Better-Auth plugin for Vipps OAuth
Readme
Vipps OAuth plugin for Better Auth
A small plugin that adds Vipps MobilePay OAuth2/OpenID Connect to Better Auth.
Install
pnpm add @webstad/vipps-oauth-plugin
# peer dep
pnpm add better-authQuick start
import { betterAuth } from 'better-auth';
import { vippsOAuth } from '@webstad/vipps-oauth-plugin';
export const auth = betterAuth({
plugins: [
vippsOAuth({
clientId: process.env.VIPPS_CLIENT_ID!,
clientSecret: process.env.VIPPS_CLIENT_SECRET!,
environment: process.env.NODE_ENV === 'production' ? 'prod' : 'test',
// redirectUri: 'https://your.app/api/auth/callback', // optional
// scopesPreset: 'basic', // or 'profile' | 'address'
})
]
});Options (most common)
- environment:
'test' | 'prod' - redirectUri: optional custom callback URL
- scopesPreset:
'basic' | 'profile' | 'address'(adds sensible scopes) - scopes: custom scopes array (always includes
openid)
You can also map the OIDC profile to your user schema:
vippsOAuth({
/* ...required config... */
mapProfileToUser: (profile) => ({ name: profile.name, email: profile.email })
});Types
Exports useful types like VippsOAuthConfig and VippsUserInfo.
License
MIT
