capacitor-auth-manager 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorAuthManager.podspec +1 -1
- package/Readme.md +223 -103
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/AuthStorage.java +28 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/CapacitorAuthManager.java +109 -15
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/FacebookAuthProvider.java +389 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/GoogleAuthProvider.java +353 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/MicrosoftAuthProvider.java +455 -0
- package/android/src/main/java/com/aoneahsan/capacitor_auth_manager/ProviderFactory.java +180 -0
- package/dist/angular.cjs.js +7017 -0
- package/dist/angular.cjs.js.map +1 -0
- package/dist/core.cjs.js +2155 -444
- package/dist/core.cjs.js.map +1 -1
- package/dist/esm/angular/auth.guard.d.ts +18 -0
- package/dist/esm/angular/auth.guard.js +82 -0
- package/dist/esm/angular/auth.guard.js.map +1 -0
- package/dist/esm/angular/auth.module.d.ts +18 -0
- package/dist/esm/angular/auth.module.js +56 -0
- package/dist/esm/angular/auth.module.js.map +1 -0
- package/dist/esm/angular/auth.service.d.ts +108 -0
- package/dist/esm/angular/auth.service.js +224 -0
- package/dist/esm/angular/auth.service.js.map +1 -0
- package/dist/esm/angular/index.d.ts +3 -0
- package/dist/esm/angular/index.js +4 -0
- package/dist/esm/angular/index.js.map +1 -0
- package/dist/esm/core/auth-manager.d.ts +61 -1
- package/dist/esm/core/auth-manager.js +285 -24
- package/dist/esm/core/auth-manager.js.map +1 -1
- package/dist/esm/core/platform.d.ts +7 -0
- package/dist/esm/core/platform.js +30 -10
- package/dist/esm/core/platform.js.map +1 -1
- package/dist/esm/core/provider-manifests.d.ts +9 -0
- package/dist/esm/core/provider-manifests.js +471 -0
- package/dist/esm/core/provider-manifests.js.map +1 -0
- package/dist/esm/core/provider-registry.d.ts +19 -1
- package/dist/esm/core/provider-registry.js +72 -480
- package/dist/esm/core/provider-registry.js.map +1 -1
- package/dist/esm/core/types.d.ts +18 -7
- package/dist/esm/definitions.d.ts +42 -1
- package/dist/esm/definitions.js +28 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/base-provider.d.ts +3 -3
- package/dist/esm/providers/base-provider.js +26 -1
- package/dist/esm/providers/base-provider.js.map +1 -1
- package/dist/esm/providers/oauth-provider.d.ts +23 -2
- package/dist/esm/providers/oauth-provider.js +134 -17
- package/dist/esm/providers/oauth-provider.js.map +1 -1
- package/dist/esm/providers/provider-factory.d.ts +3 -1
- package/dist/esm/providers/provider-factory.js +29 -41
- package/dist/esm/providers/provider-factory.js.map +1 -1
- package/dist/esm/providers/web/apple-provider.d.ts +2 -1
- package/dist/esm/providers/web/apple-provider.js +25 -9
- package/dist/esm/providers/web/apple-provider.js.map +1 -1
- package/dist/esm/providers/web/biometric-provider.d.ts +14 -0
- package/dist/esm/providers/web/biometric-provider.js +116 -18
- package/dist/esm/providers/web/biometric-provider.js.map +1 -1
- package/dist/esm/providers/web/email-code-provider.d.ts +48 -0
- package/dist/esm/providers/web/email-code-provider.js +295 -0
- package/dist/esm/providers/web/email-code-provider.js.map +1 -0
- package/dist/esm/providers/web/email-password-provider.js +29 -28
- package/dist/esm/providers/web/email-password-provider.js.map +1 -1
- package/dist/esm/providers/web/facebook-provider.d.ts +52 -1
- package/dist/esm/providers/web/facebook-provider.js +2 -2
- package/dist/esm/providers/web/facebook-provider.js.map +1 -1
- package/dist/esm/providers/web/firebase-provider.d.ts +5 -3
- package/dist/esm/providers/web/firebase-provider.js +74 -42
- package/dist/esm/providers/web/firebase-provider.js.map +1 -1
- package/dist/esm/providers/web/github-provider.d.ts +9 -0
- package/dist/esm/providers/web/github-provider.js +91 -14
- package/dist/esm/providers/web/github-provider.js.map +1 -1
- package/dist/esm/providers/web/index.d.ts +2 -0
- package/dist/esm/providers/web/index.js +2 -0
- package/dist/esm/providers/web/index.js.map +1 -1
- package/dist/esm/providers/web/linkedin-provider.d.ts +2 -3
- package/dist/esm/providers/web/linkedin-provider.js +40 -14
- package/dist/esm/providers/web/linkedin-provider.js.map +1 -1
- package/dist/esm/providers/web/magic-link-provider.d.ts +3 -3
- package/dist/esm/providers/web/magic-link-provider.js +40 -26
- package/dist/esm/providers/web/magic-link-provider.js.map +1 -1
- package/dist/esm/providers/web/microsoft-provider.d.ts +2 -0
- package/dist/esm/providers/web/microsoft-provider.js +45 -20
- package/dist/esm/providers/web/microsoft-provider.js.map +1 -1
- package/dist/esm/providers/web/phone-password-provider.d.ts +66 -0
- package/dist/esm/providers/web/phone-password-provider.js +438 -0
- package/dist/esm/providers/web/phone-password-provider.js.map +1 -0
- package/dist/esm/providers/web/slack-provider.d.ts +2 -3
- package/dist/esm/providers/web/slack-provider.js +38 -14
- package/dist/esm/providers/web/slack-provider.js.map +1 -1
- package/dist/esm/providers/web/sms-provider.d.ts +3 -3
- package/dist/esm/providers/web/sms-provider.js +25 -18
- package/dist/esm/providers/web/sms-provider.js.map +1 -1
- package/dist/esm/providers/web/username-password-provider.js +23 -22
- package/dist/esm/providers/web/username-password-provider.js.map +1 -1
- package/dist/esm/react/hooks.d.ts +110 -0
- package/dist/esm/react/hooks.js +307 -0
- package/dist/esm/react/hooks.js.map +1 -0
- package/dist/esm/react/index.d.ts +2 -0
- package/dist/esm/react/index.js +3 -0
- package/dist/esm/react/index.js.map +1 -0
- package/dist/esm/react/types.d.ts +30 -0
- package/dist/esm/react/types.js +2 -0
- package/dist/esm/react/types.js.map +1 -0
- package/dist/esm/utils/auth-error.d.ts +7 -0
- package/dist/esm/utils/auth-error.js +31 -5
- package/dist/esm/utils/auth-error.js.map +1 -1
- package/dist/esm/utils/event-emitter.d.ts +7 -0
- package/dist/esm/utils/event-emitter.js +8 -2
- package/dist/esm/utils/event-emitter.js.map +1 -1
- package/dist/esm/utils/logger.d.ts +28 -1
- package/dist/esm/utils/logger.js +115 -1
- package/dist/esm/utils/logger.js.map +1 -1
- package/dist/esm/utils/pending-verification-store.d.ts +59 -0
- package/dist/esm/utils/pending-verification-store.js +103 -0
- package/dist/esm/utils/pending-verification-store.js.map +1 -0
- package/dist/esm/utils/storage.d.ts +29 -1
- package/dist/esm/utils/storage.js +64 -5
- package/dist/esm/utils/storage.js.map +1 -1
- package/dist/esm/vue/composables.d.ts +124 -0
- package/dist/esm/vue/composables.js +290 -0
- package/dist/esm/vue/composables.js.map +1 -0
- package/dist/esm/vue/index.d.ts +1 -0
- package/dist/esm/vue/index.js +2 -0
- package/dist/esm/vue/index.js.map +1 -0
- package/dist/esm/web.d.ts +32 -7
- package/dist/esm/web.js +247 -52
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +2606 -670
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2606 -670
- package/dist/plugin.js.map +1 -1
- package/dist/react.cjs.js +6972 -0
- package/dist/react.cjs.js.map +1 -0
- package/dist/vue.cjs.js +6955 -0
- package/dist/vue.cjs.js.map +1 -0
- package/ios/Plugin/AppleAuthProvider.swift +288 -0
- package/ios/Plugin/AuthStorage.swift +49 -1
- package/ios/Plugin/CapacitorAuthManager.swift +45 -23
- package/ios/Plugin/FacebookAuthProvider.swift +297 -0
- package/ios/Plugin/GitHubAuthProvider.swift +54 -0
- package/ios/Plugin/GoogleAuthProvider.swift +265 -0
- package/ios/Plugin/LinkedInAuthProvider.swift +63 -0
- package/ios/Plugin/MicrosoftAuthProvider.swift +315 -0
- package/ios/Plugin/Models.swift +4 -1
- package/ios/Plugin/OAuthWebProvider.swift +415 -0
- package/ios/Plugin/SlackAuthProvider.swift +108 -0
- package/package.json +60 -39
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in provider manifests (display metadata + human-readable setup instructions).
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `provider-registry.ts` as a pure data module (zero logic) so the registry stays
|
|
5
|
+
* under the project's file-size guideline. `ProviderRegistry` imports this array and registers each
|
|
6
|
+
* entry in its static initializer — behaviour is unchanged (see F-40).
|
|
7
|
+
*/
|
|
8
|
+
export const BUILT_IN_PROVIDER_MANIFESTS = [
|
|
9
|
+
{
|
|
10
|
+
name: 'google',
|
|
11
|
+
displayName: 'Google',
|
|
12
|
+
packageName: '@google/gsi',
|
|
13
|
+
setupInstructions: `
|
|
14
|
+
To use Google authentication, you need to:
|
|
15
|
+
|
|
16
|
+
1. Install the Google Sign-In SDK:
|
|
17
|
+
npm install @google/gsi
|
|
18
|
+
|
|
19
|
+
2. Configure your Google OAuth client:
|
|
20
|
+
- Go to https://console.cloud.google.com/
|
|
21
|
+
- Create or select a project
|
|
22
|
+
- Enable Google Sign-In API
|
|
23
|
+
- Create OAuth 2.0 credentials
|
|
24
|
+
- Add authorized JavaScript origins
|
|
25
|
+
|
|
26
|
+
3. Configure the provider:
|
|
27
|
+
auth.configure({
|
|
28
|
+
providers: {
|
|
29
|
+
google: {
|
|
30
|
+
clientId: 'YOUR_CLIENT_ID'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
`,
|
|
35
|
+
platforms: ['web', 'ios', 'android'],
|
|
36
|
+
configSchema: {
|
|
37
|
+
clientId: { type: 'string', required: true },
|
|
38
|
+
scopes: { type: 'array', items: 'string' },
|
|
39
|
+
hostedDomain: { type: 'string' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'apple',
|
|
44
|
+
displayName: 'Apple',
|
|
45
|
+
setupInstructions: `
|
|
46
|
+
To use Apple authentication:
|
|
47
|
+
|
|
48
|
+
1. Configure Sign in with Apple:
|
|
49
|
+
- Go to https://developer.apple.com/
|
|
50
|
+
- Configure your app for Sign in with Apple
|
|
51
|
+
- Create a Services ID for web
|
|
52
|
+
- Configure return URLs
|
|
53
|
+
|
|
54
|
+
2. Configure the provider:
|
|
55
|
+
auth.configure({
|
|
56
|
+
providers: {
|
|
57
|
+
apple: {
|
|
58
|
+
clientId: 'YOUR_SERVICE_ID',
|
|
59
|
+
redirectUri: 'YOUR_REDIRECT_URI'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
`,
|
|
64
|
+
platforms: ['web', 'ios'],
|
|
65
|
+
configSchema: {
|
|
66
|
+
clientId: { type: 'string', required: true },
|
|
67
|
+
redirectUri: { type: 'string', required: true },
|
|
68
|
+
scopes: { type: 'array', items: 'string' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'firebase',
|
|
73
|
+
displayName: 'Firebase Auth',
|
|
74
|
+
packageName: 'firebase',
|
|
75
|
+
setupInstructions: `
|
|
76
|
+
To use Firebase authentication:
|
|
77
|
+
|
|
78
|
+
1. Install Firebase SDK:
|
|
79
|
+
npm install firebase
|
|
80
|
+
|
|
81
|
+
2. Configure Firebase:
|
|
82
|
+
- Go to https://console.firebase.google.com/
|
|
83
|
+
- Create or select a project
|
|
84
|
+
- Add your app (Web/iOS/Android)
|
|
85
|
+
- Copy the configuration
|
|
86
|
+
|
|
87
|
+
3. Configure the provider:
|
|
88
|
+
auth.configure({
|
|
89
|
+
providers: {
|
|
90
|
+
firebase: {
|
|
91
|
+
apiKey: 'YOUR_API_KEY',
|
|
92
|
+
authDomain: 'YOUR_AUTH_DOMAIN',
|
|
93
|
+
projectId: 'YOUR_PROJECT_ID',
|
|
94
|
+
// ... other Firebase config
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
`,
|
|
99
|
+
platforms: ['web', 'ios', 'android'],
|
|
100
|
+
configSchema: {
|
|
101
|
+
apiKey: { type: 'string', required: true },
|
|
102
|
+
authDomain: { type: 'string', required: true },
|
|
103
|
+
projectId: { type: 'string', required: true },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'microsoft',
|
|
108
|
+
displayName: 'Microsoft',
|
|
109
|
+
packageName: '@azure/msal-browser',
|
|
110
|
+
setupInstructions: `
|
|
111
|
+
To use Microsoft authentication:
|
|
112
|
+
|
|
113
|
+
1. Install the Microsoft Authentication Library:
|
|
114
|
+
npm install @azure/msal-browser
|
|
115
|
+
|
|
116
|
+
2. Configure your Azure AD app:
|
|
117
|
+
- Go to https://portal.azure.com/
|
|
118
|
+
- Create or select an app registration
|
|
119
|
+
- Add platform configuration for SPA
|
|
120
|
+
- Add redirect URIs
|
|
121
|
+
|
|
122
|
+
3. Configure the provider:
|
|
123
|
+
auth.configure({
|
|
124
|
+
providers: {
|
|
125
|
+
microsoft: {
|
|
126
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
127
|
+
authority: 'YOUR_AUTHORITY', // optional
|
|
128
|
+
redirectUri: 'YOUR_REDIRECT_URI' // optional
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
`,
|
|
133
|
+
platforms: ['web'],
|
|
134
|
+
configSchema: {
|
|
135
|
+
clientId: { type: 'string', required: true },
|
|
136
|
+
authority: { type: 'string' },
|
|
137
|
+
redirectUri: { type: 'string' },
|
|
138
|
+
scopes: { type: 'array', items: 'string' },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'facebook',
|
|
143
|
+
displayName: 'Facebook',
|
|
144
|
+
setupInstructions: `
|
|
145
|
+
To use Facebook authentication:
|
|
146
|
+
|
|
147
|
+
1. Configure your Facebook app:
|
|
148
|
+
- Go to https://developers.facebook.com/
|
|
149
|
+
- Create or select an app
|
|
150
|
+
- Add Facebook Login product
|
|
151
|
+
- Configure OAuth redirect URIs
|
|
152
|
+
|
|
153
|
+
2. Add Facebook SDK to your HTML:
|
|
154
|
+
<script async defer crossorigin="anonymous"
|
|
155
|
+
src="https://connect.facebook.net/en_US/sdk.js"></script>
|
|
156
|
+
|
|
157
|
+
3. Configure the provider:
|
|
158
|
+
auth.configure({
|
|
159
|
+
providers: {
|
|
160
|
+
facebook: {
|
|
161
|
+
appId: 'YOUR_APP_ID',
|
|
162
|
+
version: 'v18.0' // optional
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
`,
|
|
167
|
+
platforms: ['web'],
|
|
168
|
+
configSchema: {
|
|
169
|
+
appId: { type: 'string', required: true },
|
|
170
|
+
version: { type: 'string' },
|
|
171
|
+
scopes: { type: 'array', items: 'string' },
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'github',
|
|
176
|
+
displayName: 'GitHub',
|
|
177
|
+
setupInstructions: `
|
|
178
|
+
To use GitHub authentication:
|
|
179
|
+
|
|
180
|
+
1. Configure your GitHub OAuth app:
|
|
181
|
+
- Go to https://github.com/settings/developers
|
|
182
|
+
- Create a new OAuth App
|
|
183
|
+
- Set authorization callback URL
|
|
184
|
+
|
|
185
|
+
2. Configure the provider:
|
|
186
|
+
auth.configure({
|
|
187
|
+
providers: {
|
|
188
|
+
github: {
|
|
189
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
190
|
+
redirectUri: 'YOUR_REDIRECT_URI'
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
Note: You'll need a backend service to exchange the authorization code for an access token.
|
|
196
|
+
`,
|
|
197
|
+
platforms: ['web'],
|
|
198
|
+
configSchema: {
|
|
199
|
+
clientId: { type: 'string', required: true },
|
|
200
|
+
redirectUri: { type: 'string' },
|
|
201
|
+
scopes: { type: 'array', items: 'string' },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'magic-link',
|
|
206
|
+
displayName: 'Email Magic Link',
|
|
207
|
+
setupInstructions: `
|
|
208
|
+
To use Email Magic Link authentication:
|
|
209
|
+
|
|
210
|
+
1. Set up a backend endpoint to send emails:
|
|
211
|
+
- Endpoint should accept POST requests with email and magic link
|
|
212
|
+
- Send email with the magic link to the user
|
|
213
|
+
|
|
214
|
+
2. Configure the provider:
|
|
215
|
+
auth.configure({
|
|
216
|
+
providers: {
|
|
217
|
+
'magic-link': {
|
|
218
|
+
sendLinkUrl: 'https://your-api.com/send-magic-link',
|
|
219
|
+
verifyUrl: 'https://your-api.com/verify-magic-link', // Optional
|
|
220
|
+
redirectUrl: window.location.origin + '/auth-callback'
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
`,
|
|
225
|
+
platforms: ['web'],
|
|
226
|
+
configSchema: {
|
|
227
|
+
sendLinkUrl: { type: 'string', required: true },
|
|
228
|
+
verifyUrl: { type: 'string' },
|
|
229
|
+
redirectUrl: { type: 'string' },
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'sms',
|
|
234
|
+
displayName: 'SMS Authentication',
|
|
235
|
+
setupInstructions: `
|
|
236
|
+
To use SMS authentication:
|
|
237
|
+
|
|
238
|
+
1. Set up backend endpoints:
|
|
239
|
+
- Send code endpoint: POST request to send SMS
|
|
240
|
+
- Verify code endpoint: POST request to verify SMS code
|
|
241
|
+
|
|
242
|
+
2. Configure the provider:
|
|
243
|
+
auth.configure({
|
|
244
|
+
providers: {
|
|
245
|
+
sms: {
|
|
246
|
+
sendCodeUrl: 'https://your-api.com/sms/send',
|
|
247
|
+
verifyCodeUrl: 'https://your-api.com/sms/verify',
|
|
248
|
+
countryCode: '+1', // Default country code
|
|
249
|
+
codeLength: 6 // SMS code length
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
`,
|
|
254
|
+
platforms: ['web', 'ios', 'android'],
|
|
255
|
+
configSchema: {
|
|
256
|
+
sendCodeUrl: { type: 'string', required: true },
|
|
257
|
+
verifyCodeUrl: { type: 'string', required: true },
|
|
258
|
+
countryCode: { type: 'string' },
|
|
259
|
+
codeLength: { type: 'number' },
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'email-password',
|
|
264
|
+
displayName: 'Email & Password',
|
|
265
|
+
setupInstructions: `
|
|
266
|
+
To use Email/Password authentication:
|
|
267
|
+
|
|
268
|
+
1. Set up backend API endpoints for authentication
|
|
269
|
+
|
|
270
|
+
2. Configure the provider:
|
|
271
|
+
auth.configure({
|
|
272
|
+
providers: {
|
|
273
|
+
'email-password': {
|
|
274
|
+
apiUrl: 'https://your-api.com',
|
|
275
|
+
passwordRequirements: {
|
|
276
|
+
minLength: 8,
|
|
277
|
+
requireUppercase: true,
|
|
278
|
+
requireNumbers: true
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
`,
|
|
284
|
+
platforms: ['web', 'ios', 'android'],
|
|
285
|
+
configSchema: {
|
|
286
|
+
apiUrl: { type: 'string', required: true },
|
|
287
|
+
passwordRequirements: { type: 'object' },
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: 'biometric',
|
|
292
|
+
displayName: 'Biometric Authentication',
|
|
293
|
+
packageName: 'capacitor-biometric-authentication',
|
|
294
|
+
setupInstructions: `
|
|
295
|
+
To use Biometric authentication:
|
|
296
|
+
|
|
297
|
+
1. Install the capacitor-biometric-authentication plugin:
|
|
298
|
+
npm install capacitor-biometric-authentication
|
|
299
|
+
npx cap sync
|
|
300
|
+
|
|
301
|
+
2. Configure the provider:
|
|
302
|
+
auth.configure({
|
|
303
|
+
providers: {
|
|
304
|
+
biometric: {
|
|
305
|
+
reason: 'Authenticate to access your account',
|
|
306
|
+
title: 'Authentication Required'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
Note: Users must first authenticate with another method before enabling biometric authentication.
|
|
312
|
+
`,
|
|
313
|
+
platforms: ['ios', 'android'],
|
|
314
|
+
configSchema: {
|
|
315
|
+
reason: { type: 'string' },
|
|
316
|
+
title: { type: 'string' },
|
|
317
|
+
subtitle: { type: 'string' },
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'slack',
|
|
322
|
+
displayName: 'Slack',
|
|
323
|
+
setupInstructions: `
|
|
324
|
+
To use Slack authentication:
|
|
325
|
+
|
|
326
|
+
1. Create a Slack App:
|
|
327
|
+
- Go to https://api.slack.com/apps
|
|
328
|
+
- Click "Create New App" > "From scratch"
|
|
329
|
+
- Name your app and select workspace
|
|
330
|
+
|
|
331
|
+
2. Configure OAuth & Permissions:
|
|
332
|
+
- Add redirect URL: https://your-app.com/auth/slack/callback
|
|
333
|
+
- Add required scopes:
|
|
334
|
+
- openid
|
|
335
|
+
- profile
|
|
336
|
+
- email
|
|
337
|
+
|
|
338
|
+
3. Get your credentials:
|
|
339
|
+
- Go to "Basic Information"
|
|
340
|
+
- Copy Client ID and Client Secret
|
|
341
|
+
|
|
342
|
+
4. Configure the provider:
|
|
343
|
+
auth.configure({
|
|
344
|
+
providers: {
|
|
345
|
+
slack: {
|
|
346
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
347
|
+
redirectUri: 'https://your-app.com/auth/slack/callback',
|
|
348
|
+
scopes: ['openid', 'profile', 'email'],
|
|
349
|
+
teamId: 'OPTIONAL_TEAM_ID' // Restrict to specific workspace
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
Note: Slack OAuth requires a backend service to exchange the authorization code for access tokens.
|
|
355
|
+
`,
|
|
356
|
+
platforms: ['web'],
|
|
357
|
+
configSchema: {
|
|
358
|
+
clientId: { type: 'string', required: true },
|
|
359
|
+
redirectUri: { type: 'string', required: true },
|
|
360
|
+
scopes: { type: 'array', items: 'string' },
|
|
361
|
+
teamId: { type: 'string' },
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: 'linkedin',
|
|
366
|
+
displayName: 'LinkedIn',
|
|
367
|
+
setupInstructions: `
|
|
368
|
+
To use LinkedIn authentication:
|
|
369
|
+
|
|
370
|
+
1. Create a LinkedIn App:
|
|
371
|
+
- Go to https://www.linkedin.com/developers/apps
|
|
372
|
+
- Click "Create app"
|
|
373
|
+
- Fill in required information
|
|
374
|
+
- Verify your app
|
|
375
|
+
|
|
376
|
+
2. Configure OAuth 2.0:
|
|
377
|
+
- Go to the "Auth" tab
|
|
378
|
+
- Add authorized redirect URLs:
|
|
379
|
+
- https://your-app.com/auth/linkedin/callback
|
|
380
|
+
- Note your Client ID and Client Secret
|
|
381
|
+
|
|
382
|
+
3. Configure scopes:
|
|
383
|
+
- Under "OAuth 2.0 scopes", select:
|
|
384
|
+
- openid
|
|
385
|
+
- profile
|
|
386
|
+
- email
|
|
387
|
+
|
|
388
|
+
4. Configure the provider:
|
|
389
|
+
auth.configure({
|
|
390
|
+
providers: {
|
|
391
|
+
linkedin: {
|
|
392
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
393
|
+
redirectUri: 'https://your-app.com/auth/linkedin/callback',
|
|
394
|
+
scopes: ['openid', 'profile', 'email']
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
Note: LinkedIn OAuth requires a backend service to exchange the authorization code for access tokens.
|
|
400
|
+
The redirect URI must be HTTPS in production (LinkedIn requirement).
|
|
401
|
+
`,
|
|
402
|
+
platforms: ['web'],
|
|
403
|
+
configSchema: {
|
|
404
|
+
clientId: { type: 'string', required: true },
|
|
405
|
+
redirectUri: { type: 'string', required: true },
|
|
406
|
+
scopes: { type: 'array', items: 'string' },
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: 'username-password',
|
|
411
|
+
displayName: 'Username & Password',
|
|
412
|
+
setupInstructions: `
|
|
413
|
+
To use Username/Password authentication:
|
|
414
|
+
|
|
415
|
+
1. Set up backend API endpoints:
|
|
416
|
+
- /auth/signin - Sign in with username/password
|
|
417
|
+
- /auth/signup - Create new account
|
|
418
|
+
- /auth/signout - Sign out user
|
|
419
|
+
- /auth/refresh - Refresh access token
|
|
420
|
+
- /auth/update-password - Update password
|
|
421
|
+
- /auth/check-username - Check username availability
|
|
422
|
+
|
|
423
|
+
2. Configure the provider:
|
|
424
|
+
auth.configure({
|
|
425
|
+
providers: {
|
|
426
|
+
'username-password': {
|
|
427
|
+
apiUrl: 'https://your-api.com',
|
|
428
|
+
usernameRequirements: {
|
|
429
|
+
minLength: 3,
|
|
430
|
+
maxLength: 20,
|
|
431
|
+
allowedCharacters: /^[a-zA-Z0-9_-]+$/,
|
|
432
|
+
reservedUsernames: ['admin', 'root', 'system']
|
|
433
|
+
},
|
|
434
|
+
passwordRequirements: {
|
|
435
|
+
minLength: 8,
|
|
436
|
+
requireUppercase: true,
|
|
437
|
+
requireLowercase: true,
|
|
438
|
+
requireNumbers: true,
|
|
439
|
+
requireSpecialChars: false
|
|
440
|
+
},
|
|
441
|
+
allowSignUp: true
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
3. Sign in:
|
|
447
|
+
await auth.signIn('username-password', {
|
|
448
|
+
username: 'johndoe',
|
|
449
|
+
password: 'password123'
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
4. Sign up:
|
|
453
|
+
await auth.signUp({
|
|
454
|
+
username: 'johndoe',
|
|
455
|
+
password: 'password123',
|
|
456
|
+
email: 'john@example.com', // optional
|
|
457
|
+
displayName: 'John Doe' // optional
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
Note: This provider requires a backend service to handle authentication.
|
|
461
|
+
`,
|
|
462
|
+
platforms: ['web', 'ios', 'android'],
|
|
463
|
+
configSchema: {
|
|
464
|
+
apiUrl: { type: 'string', required: true },
|
|
465
|
+
usernameRequirements: { type: 'object' },
|
|
466
|
+
passwordRequirements: { type: 'object' },
|
|
467
|
+
allowSignUp: { type: 'boolean' },
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
];
|
|
471
|
+
//# sourceMappingURL=provider-manifests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-manifests.js","sourceRoot":"","sources":["../../../src/core/provider-manifests.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAuB;IAC7D;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,aAAa;QAC1B,iBAAiB,EAAE;;;;;;;;;;;;;;;;;;;;;CAqBtB;QACG,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC;QACpC,YAAY,EAAE;YACZ,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;YAC1C,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACjC;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,OAAO;QACpB,iBAAiB,EAAE;;;;;;;;;;;;;;;;;;CAkBtB;QACG,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QACzB,YAAY,EAAE;YACZ,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC5C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/C,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;SAC3C;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,UAAU;QACvB,iBAAiB,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAuBtB;QACG,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC;QACpC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AAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;SAC3C;KACF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,qBAAqB;QAClC,iBAAiB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDtB;QACG,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC;QACpC,YAAY,EAAE;YACZ,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1C,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxC,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SACjC;KACF;CACF,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { AuthProviderInterface, ProviderManifest } from './types';
|
|
2
|
+
import { AuthPersistence } from '../definitions';
|
|
3
|
+
import type { ProviderOptions } from '../definitions';
|
|
4
|
+
import type { StorageInterface } from '../utils/storage';
|
|
5
|
+
import { Logger } from '../utils/logger';
|
|
2
6
|
export interface ProviderLoader {
|
|
3
7
|
(): Promise<{
|
|
4
8
|
default: new (config: any) => AuthProviderInterface;
|
|
@@ -6,14 +10,28 @@ export interface ProviderLoader {
|
|
|
6
10
|
default: any;
|
|
7
11
|
}>;
|
|
8
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Dependencies the registry injects into BaseAuthProvider-derived providers so they
|
|
15
|
+
* share the AuthManager's storage + logger (the same instances credentials are read from).
|
|
16
|
+
*/
|
|
17
|
+
export interface ProviderDeps {
|
|
18
|
+
storage: StorageInterface;
|
|
19
|
+
logger: Logger;
|
|
20
|
+
persistence?: AuthPersistence;
|
|
21
|
+
}
|
|
9
22
|
export declare class ProviderRegistry {
|
|
10
23
|
private static providers;
|
|
11
24
|
private static loaders;
|
|
12
25
|
private static manifests;
|
|
26
|
+
/** Providers constructed with their raw options object (not a BaseProviderConfig wrapper). */
|
|
27
|
+
private static readonly STANDALONE_PROVIDERS;
|
|
28
|
+
/** Maps AuthProvider enum values (some underscored) to the registered hyphenated loader keys. */
|
|
29
|
+
private static readonly NAME_ALIASES;
|
|
13
30
|
static registerManifest(manifest: ProviderManifest): void;
|
|
14
31
|
static registerLoader(name: string, loader: ProviderLoader): void;
|
|
15
32
|
static getManifest(name: string): ProviderManifest | undefined;
|
|
16
|
-
static
|
|
33
|
+
static canonicalName(name: string): string;
|
|
34
|
+
static getProvider(name: string, options?: ProviderOptions, deps?: ProviderDeps): Promise<AuthProviderInterface>;
|
|
17
35
|
static clearProvider(name: string): void;
|
|
18
36
|
static clearAll(): void;
|
|
19
37
|
static getAvailableProviders(): string[];
|