Skip to content

Commit b7f8b07

Browse files
committed
feat(provider): ✨ Added PayPal provider
1 parent 6eca959 commit b7f8b07

File tree

21 files changed

+1324
-1938
lines changed

21 files changed

+1324
-1938
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ Temporary Items
4848
.apdisk
4949

5050
oidcstorage
51+
docs

README.md

Lines changed: 9 additions & 689 deletions
Large diffs are not rendered by default.

playground/composables/useProviders.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ export function useProviders(currentProvider: string) {
3838
disabled: Boolean(currentProvider === 'cognito'),
3939
icon: 'i-majesticons-puzzle',
4040
},
41+
{
42+
label: 'PayPal',
43+
name: 'paypal',
44+
disabled: Boolean(currentProvider === 'paypal'),
45+
icon: 'i-simple-icons-paypal',
46+
},
4147
{
4248
label: 'Generic OIDC',
4349
name: 'oidc',

playground/nuxt.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ export default defineNuxtConfig({
8484
logoutRedirectUri: 'https://google.com', // Needs to be registered in Zitadel portal
8585
authenticationScheme: 'none', // Set this to 'header' if Code is used instead of PKCE
8686
},
87+
paypal: {
88+
clientId: '',
89+
clientSecret: '',
90+
scope: ['openid', 'profile'],
91+
authorizationUrl: 'https://www.sandbox.paypal.com/signin/authorize?flowEntry=static',
92+
tokenUrl: 'https://api-m.sandbox.paypal.com/v1/oauth2/token',
93+
userInfoUrl: 'https://api-m.sandbox.paypal.com/v1/identity/openidconnect/userinfo?schema=openid',
94+
redirectUri: 'http://127.0.0.1:3000/auth/paypal/callback',
95+
},
8796
},
8897
session: {
8998
expirationCheck: true,

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"@iconify-json/simple-icons": "^1.2.3",
1818
"@nuxtjs/color-mode": "^3.5.1",
1919
"@unocss/nuxt": "^0.62.4",
20-
"nuxt-oidc-auth": "workspace:^"
20+
"nuxt-oidc-auth": "latest"
2121
}
2222
}

playground/pages/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function handleRefresh() {
1010
</script>
1111

1212
<template>
13-
<div class="grid grid-cols-2 w-full">
13+
<div class="grid grid-cols-3 w-full">
1414
<div class="col-start-1 flex flex-col items-center gap-4">
1515
<p class="text-xl">
1616
Login with
@@ -32,6 +32,11 @@ async function handleRefresh() {
3232
<span :class="provider.icon" />
3333
<span class="pl-2">{{ provider.label }}</span>
3434
</button>
35+
</div>
36+
<div class="col-start-2 flex flex-col items-center gap-4">
37+
<p class="text-xl">
38+
Session controls
39+
</p>
3540
<p>Logged in: {{ loggedIn }}</p>
3641
<p>Current provider: {{ currentProvider }}</p>
3742
<button
@@ -67,7 +72,7 @@ async function handleRefresh() {
6772
<span class="pl-2">Clear session</span>
6873
</button>
6974
</div>
70-
<div class="col-start-2">
75+
<div class="col-start-3">
7176
<p class="pb-4 text-xl">
7277
User object
7378
</p>

pnpm-lock.yaml

Lines changed: 1248 additions & 1216 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
packages:
22
- playground
33
- client
4+
- '!docs/**'

src/runtime/providers/auth0.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@ interface Auth0ProviderConfig {
3333
type Auth0RequiredFields = 'baseUrl' | 'clientId' | 'clientSecret'
3434

3535
export const auth0 = defineOidcProvider<Auth0ProviderConfig, Auth0RequiredFields>({
36-
responseType: 'code',
3736
tokenRequestType: 'json',
3837
authenticationScheme: 'body',
3938
userInfoUrl: 'userinfo',
40-
grantType: 'authorization_code',
41-
scope: ['openid'],
4239
pkce: true,
4340
state: true,
4441
nonce: false,

src/runtime/providers/cognito.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ type CognitoRequiredFields = 'baseUrl' | 'clientId' | 'clientSecret' | 'logoutRe
44

55
export const cognito = defineOidcProvider<OidcProviderConfig, CognitoRequiredFields>({
66
userNameClaim: 'username',
7-
responseType: 'code',
87
tokenRequestType: 'form-urlencoded',
98
authenticationScheme: 'header',
109
userInfoUrl: 'oauth2/userInfo',
@@ -13,8 +12,6 @@ export const cognito = defineOidcProvider<OidcProviderConfig, CognitoRequiredFie
1312
pkce: true,
1413
state: true,
1514
nonce: true,
16-
scopeInTokenRequest: false,
17-
callbackRedirectUrl: '/',
1815
authorizationUrl: 'oauth2/authorize',
1916
tokenUrl: 'oauth2/token',
2017
logoutUrl: 'logout',

0 commit comments

Comments
 (0)