@draftlab/auth 0.0.1
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/dist/adapters/node.d.ts +18 -0
- package/dist/adapters/node.js +71 -0
- package/dist/allow-CixonwTW.d.ts +59 -0
- package/dist/allow-DX5cehSc.js +63 -0
- package/dist/allow.d.ts +2 -0
- package/dist/allow.js +4 -0
- package/dist/base-DRutbxgL.js +422 -0
- package/dist/client.d.ts +413 -0
- package/dist/client.js +209 -0
- package/dist/code-l_uvMR1j.d.ts +212 -0
- package/dist/core-8WTqfnb4.d.ts +129 -0
- package/dist/core-CncE5rPg.js +498 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +14 -0
- package/dist/error-CWAdNAzm.d.ts +243 -0
- package/dist/error-DgAKK7b2.js +237 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.js +3 -0
- package/dist/form-6XKM_cOk.js +61 -0
- package/dist/icon-Ci5uqGB_.js +192 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +14 -0
- package/dist/keys-EEfxEGfO.js +140 -0
- package/dist/keys.d.ts +67 -0
- package/dist/keys.js +5 -0
- package/dist/oauth2-B7-6Z7Lc.js +155 -0
- package/dist/oauth2-DtKwtl8p.d.ts +176 -0
- package/dist/password-Cm0dRMwa.d.ts +385 -0
- package/dist/pkce-276Za_rZ.js +162 -0
- package/dist/pkce.d.ts +72 -0
- package/dist/pkce.js +3 -0
- package/dist/provider/code.d.ts +4 -0
- package/dist/provider/code.js +145 -0
- package/dist/provider/facebook.d.ts +137 -0
- package/dist/provider/facebook.js +85 -0
- package/dist/provider/github.d.ts +141 -0
- package/dist/provider/github.js +88 -0
- package/dist/provider/google.d.ts +113 -0
- package/dist/provider/google.js +62 -0
- package/dist/provider/oauth2.d.ts +4 -0
- package/dist/provider/oauth2.js +7 -0
- package/dist/provider/password.d.ts +4 -0
- package/dist/provider/password.js +366 -0
- package/dist/provider/provider.d.ts +3 -0
- package/dist/provider/provider.js +44 -0
- package/dist/provider-CwWMG-1l.d.ts +227 -0
- package/dist/random-SXMYlaVr.js +87 -0
- package/dist/random.d.ts +66 -0
- package/dist/random.js +3 -0
- package/dist/select-BjySLL8I.js +280 -0
- package/dist/storage/memory.d.ts +82 -0
- package/dist/storage/memory.js +127 -0
- package/dist/storage/storage.d.ts +2 -0
- package/dist/storage/storage.js +3 -0
- package/dist/storage/turso.d.ts +31 -0
- package/dist/storage/turso.js +117 -0
- package/dist/storage/unstorage.d.ts +38 -0
- package/dist/storage/unstorage.js +97 -0
- package/dist/storage-BEaqEPNQ.js +62 -0
- package/dist/storage-CxKerLlc.d.ts +162 -0
- package/dist/subject-DiQdRWGt.d.ts +62 -0
- package/dist/subject.d.ts +3 -0
- package/dist/subject.js +36 -0
- package/dist/theme-C9by7VXf.d.ts +209 -0
- package/dist/theme-CswaLtbW.js +120 -0
- package/dist/themes/theme.d.ts +2 -0
- package/dist/themes/theme.js +3 -0
- package/dist/types.d.ts +94 -0
- package/dist/types.js +0 -0
- package/dist/ui/base.d.ts +43 -0
- package/dist/ui/base.js +4 -0
- package/dist/ui/code.d.ts +158 -0
- package/dist/ui/code.js +197 -0
- package/dist/ui/form.d.ts +31 -0
- package/dist/ui/form.js +3 -0
- package/dist/ui/icon.d.ts +98 -0
- package/dist/ui/icon.js +3 -0
- package/dist/ui/password.d.ts +54 -0
- package/dist/ui/password.js +300 -0
- package/dist/ui/select.d.ts +233 -0
- package/dist/ui/select.js +6 -0
- package/dist/util-CSdHUFOo.js +108 -0
- package/dist/util-ChlgVqPN.d.ts +72 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +3 -0
- package/package.json +63 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import "../storage-CxKerLlc.js";
|
|
2
|
+
import { Provider } from "../provider-CwWMG-1l.js";
|
|
3
|
+
import { Oauth2UserData, Oauth2WrappedConfig } from "../oauth2-DtKwtl8p.js";
|
|
4
|
+
|
|
5
|
+
//#region src/provider/github.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for GitHub OAuth 2.0 provider.
|
|
9
|
+
* Extends the base OAuth 2.0 configuration with GitHub-specific documentation.
|
|
10
|
+
*/
|
|
11
|
+
interface GithubConfig extends Oauth2WrappedConfig {
|
|
12
|
+
/**
|
|
13
|
+
* GitHub OAuth App client ID or GitHub App client ID.
|
|
14
|
+
* Found in your GitHub App settings or OAuth App settings.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* {
|
|
19
|
+
* clientID: "Iv1.a629723000043722" // OAuth App
|
|
20
|
+
* // or
|
|
21
|
+
* clientID: "Iv23liAG5t7VwMkUsKTi" // GitHub App
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
readonly clientID: string;
|
|
26
|
+
/**
|
|
27
|
+
* GitHub OAuth App client secret or GitHub App client secret.
|
|
28
|
+
* Keep this secure and never expose it to client-side code.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* {
|
|
33
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
readonly clientSecret: string;
|
|
38
|
+
/**
|
|
39
|
+
* GitHub OAuth scopes to request access for.
|
|
40
|
+
* Determines what data and actions your app can access.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* {
|
|
45
|
+
* scopes: [
|
|
46
|
+
* "user:email", // Access user email addresses
|
|
47
|
+
* "read:user", // Read user profile info
|
|
48
|
+
* "public_repo", // Access public repositories
|
|
49
|
+
* "read:org" // Read organization membership
|
|
50
|
+
* ]
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
readonly scopes: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Additional query parameters for GitHub OAuth authorization.
|
|
57
|
+
* Useful for GitHub-specific options like restricting to organizations.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* {
|
|
62
|
+
* query: {
|
|
63
|
+
* allow_signup: "false", // Disable new account creation
|
|
64
|
+
* login: "suggested-username" // Pre-fill username field
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
readonly query?: Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a GitHub OAuth 2.0 authentication provider.
|
|
73
|
+
* Supports both GitHub OAuth Apps and GitHub Apps for user authentication.
|
|
74
|
+
*
|
|
75
|
+
* @param config - GitHub OAuth 2.0 configuration
|
|
76
|
+
* @returns OAuth 2.0 provider configured for GitHub
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* // Basic GitHub authentication
|
|
81
|
+
* const basicGithub = GithubProvider({
|
|
82
|
+
* clientID: process.env.GITHUB_CLIENT_ID,
|
|
83
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET
|
|
84
|
+
* })
|
|
85
|
+
*
|
|
86
|
+
* // GitHub with specific scopes
|
|
87
|
+
* const githubWithScopes = GithubProvider({
|
|
88
|
+
* clientID: process.env.GITHUB_CLIENT_ID,
|
|
89
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
|
90
|
+
* scopes: [
|
|
91
|
+
* "user:email",
|
|
92
|
+
* "read:user",
|
|
93
|
+
* "public_repo",
|
|
94
|
+
* "read:org"
|
|
95
|
+
* ]
|
|
96
|
+
* })
|
|
97
|
+
*
|
|
98
|
+
* // GitHub with custom authorization options
|
|
99
|
+
* const restrictedGithub = GithubProvider({
|
|
100
|
+
* clientID: process.env.GITHUB_CLIENT_ID,
|
|
101
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
|
102
|
+
* scopes: ["user:email", "read:user"],
|
|
103
|
+
* query: {
|
|
104
|
+
* allow_signup: "false" // Don't allow new GitHub account creation
|
|
105
|
+
* }
|
|
106
|
+
* })
|
|
107
|
+
*
|
|
108
|
+
* // Using the access token to fetch data
|
|
109
|
+
* export default issuer({
|
|
110
|
+
* providers: { github: githubWithScopes },
|
|
111
|
+
* success: async (ctx, value) => {
|
|
112
|
+
* if (value.provider === "github") {
|
|
113
|
+
* const token = value.tokenset.access
|
|
114
|
+
*
|
|
115
|
+
* // Get user profile
|
|
116
|
+
* const userRes = await fetch('https://api.github.com/user', {
|
|
117
|
+
* headers: { Authorization: `Bearer ${token}` }
|
|
118
|
+
* })
|
|
119
|
+
* const user = await userRes.json()
|
|
120
|
+
*
|
|
121
|
+
* // Get user repositories (if repo scope granted)
|
|
122
|
+
* const reposRes = await fetch('https://api.github.com/user/repos', {
|
|
123
|
+
* headers: { Authorization: `Bearer ${token}` }
|
|
124
|
+
* })
|
|
125
|
+
* const repos = await reposRes.json()
|
|
126
|
+
*
|
|
127
|
+
* return ctx.subject("user", {
|
|
128
|
+
* githubId: user.id,
|
|
129
|
+
* username: user.login,
|
|
130
|
+
* email: user.email,
|
|
131
|
+
* name: user.name,
|
|
132
|
+
* repoCount: repos.length
|
|
133
|
+
* })
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* })
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
declare const GithubProvider: (config: GithubConfig) => Provider<Oauth2UserData>;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { GithubConfig, GithubProvider };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "../util-CSdHUFOo.js";
|
|
2
|
+
import "../error-DgAKK7b2.js";
|
|
3
|
+
import "../pkce-276Za_rZ.js";
|
|
4
|
+
import "../random-SXMYlaVr.js";
|
|
5
|
+
import { Oauth2Provider } from "../oauth2-B7-6Z7Lc.js";
|
|
6
|
+
|
|
7
|
+
//#region src/provider/github.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates a GitHub OAuth 2.0 authentication provider.
|
|
10
|
+
* Supports both GitHub OAuth Apps and GitHub Apps for user authentication.
|
|
11
|
+
*
|
|
12
|
+
* @param config - GitHub OAuth 2.0 configuration
|
|
13
|
+
* @returns OAuth 2.0 provider configured for GitHub
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* // Basic GitHub authentication
|
|
18
|
+
* const basicGithub = GithubProvider({
|
|
19
|
+
* clientID: process.env.GITHUB_CLIENT_ID,
|
|
20
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // GitHub with specific scopes
|
|
24
|
+
* const githubWithScopes = GithubProvider({
|
|
25
|
+
* clientID: process.env.GITHUB_CLIENT_ID,
|
|
26
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
|
27
|
+
* scopes: [
|
|
28
|
+
* "user:email",
|
|
29
|
+
* "read:user",
|
|
30
|
+
* "public_repo",
|
|
31
|
+
* "read:org"
|
|
32
|
+
* ]
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* // GitHub with custom authorization options
|
|
36
|
+
* const restrictedGithub = GithubProvider({
|
|
37
|
+
* clientID: process.env.GITHUB_CLIENT_ID,
|
|
38
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
|
39
|
+
* scopes: ["user:email", "read:user"],
|
|
40
|
+
* query: {
|
|
41
|
+
* allow_signup: "false" // Don't allow new GitHub account creation
|
|
42
|
+
* }
|
|
43
|
+
* })
|
|
44
|
+
*
|
|
45
|
+
* // Using the access token to fetch data
|
|
46
|
+
* export default issuer({
|
|
47
|
+
* providers: { github: githubWithScopes },
|
|
48
|
+
* success: async (ctx, value) => {
|
|
49
|
+
* if (value.provider === "github") {
|
|
50
|
+
* const token = value.tokenset.access
|
|
51
|
+
*
|
|
52
|
+
* // Get user profile
|
|
53
|
+
* const userRes = await fetch('https://api.github.com/user', {
|
|
54
|
+
* headers: { Authorization: `Bearer ${token}` }
|
|
55
|
+
* })
|
|
56
|
+
* const user = await userRes.json()
|
|
57
|
+
*
|
|
58
|
+
* // Get user repositories (if repo scope granted)
|
|
59
|
+
* const reposRes = await fetch('https://api.github.com/user/repos', {
|
|
60
|
+
* headers: { Authorization: `Bearer ${token}` }
|
|
61
|
+
* })
|
|
62
|
+
* const repos = await reposRes.json()
|
|
63
|
+
*
|
|
64
|
+
* return ctx.subject("user", {
|
|
65
|
+
* githubId: user.id,
|
|
66
|
+
* username: user.login,
|
|
67
|
+
* email: user.email,
|
|
68
|
+
* name: user.name,
|
|
69
|
+
* repoCount: repos.length
|
|
70
|
+
* })
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* })
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
const GithubProvider = (config) => {
|
|
77
|
+
return Oauth2Provider({
|
|
78
|
+
...config,
|
|
79
|
+
type: "github",
|
|
80
|
+
endpoint: {
|
|
81
|
+
authorization: "https://github.com/login/oauth/authorize",
|
|
82
|
+
token: "https://github.com/login/oauth/access_token"
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { GithubProvider };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import "../storage-CxKerLlc.js";
|
|
2
|
+
import { Provider } from "../provider-CwWMG-1l.js";
|
|
3
|
+
import { Oauth2UserData, Oauth2WrappedConfig } from "../oauth2-DtKwtl8p.js";
|
|
4
|
+
|
|
5
|
+
//#region src/provider/google.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for Google OAuth 2.0 provider.
|
|
9
|
+
* Extends the base OAuth 2.0 configuration with Google-specific defaults.
|
|
10
|
+
*/
|
|
11
|
+
interface GoogleConfig extends Oauth2WrappedConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Google OAuth 2.0 client ID from Google Cloud Console.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* {
|
|
18
|
+
* clientID: "123456789-abc123.apps.googleusercontent.com"
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
readonly clientID: string;
|
|
23
|
+
/**
|
|
24
|
+
* Google OAuth 2.0 client secret from Google Cloud Console.
|
|
25
|
+
* Required for server-side OAuth 2.0 flows.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* {
|
|
30
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
readonly clientSecret: string;
|
|
35
|
+
/**
|
|
36
|
+
* Google OAuth 2.0 scopes to request.
|
|
37
|
+
* Common scopes include 'profile', 'email', and specific Google API scopes.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* {
|
|
42
|
+
* scopes: [
|
|
43
|
+
* "profile",
|
|
44
|
+
* "email",
|
|
45
|
+
* "https://www.googleapis.com/auth/calendar.readonly",
|
|
46
|
+
* "https://www.googleapis.com/auth/drive.file"
|
|
47
|
+
* ]
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
readonly scopes: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Additional query parameters for Google OAuth 2.0.
|
|
54
|
+
* Useful for Google-specific options like hosted domain restrictions.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* {
|
|
59
|
+
* query: {
|
|
60
|
+
* hd: "mycompany.com", // Restrict to Google Workspace domain
|
|
61
|
+
* access_type: "offline", // Request refresh token
|
|
62
|
+
* prompt: "consent", // Force consent screen
|
|
63
|
+
* include_granted_scopes: "true" // Incremental authorization
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
readonly query?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Creates a Google OAuth 2.0 authentication provider.
|
|
72
|
+
* Use this when you need access tokens to call Google APIs on behalf of the user.
|
|
73
|
+
*
|
|
74
|
+
* @param config - Google OAuth 2.0 configuration
|
|
75
|
+
* @returns OAuth 2.0 provider configured for Google
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* // Basic setup for user authentication
|
|
80
|
+
* const basicGoogle = GoogleProvider({
|
|
81
|
+
* clientID: process.env.GOOGLE_CLIENT_ID,
|
|
82
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET
|
|
83
|
+
* })
|
|
84
|
+
*
|
|
85
|
+
* // Advanced setup with API access
|
|
86
|
+
* const advancedGoogle = GoogleProvider({
|
|
87
|
+
* clientID: process.env.GOOGLE_CLIENT_ID,
|
|
88
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
|
89
|
+
* scopes: [
|
|
90
|
+
* "profile",
|
|
91
|
+
* "email",
|
|
92
|
+
* "https://www.googleapis.com/auth/calendar.readonly",
|
|
93
|
+
* "https://www.googleapis.com/auth/drive.file"
|
|
94
|
+
* ],
|
|
95
|
+
* query: {
|
|
96
|
+
* access_type: "offline", // Get refresh token
|
|
97
|
+
* prompt: "consent", // Force consent for refresh token
|
|
98
|
+
* hd: "mycompany.com" // Restrict to company domain
|
|
99
|
+
* }
|
|
100
|
+
* })
|
|
101
|
+
*
|
|
102
|
+
* // Use the access token for API calls
|
|
103
|
+
* success: async (ctx, value) => {
|
|
104
|
+
* const accessToken = value.tokenset.access
|
|
105
|
+
* const response = await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
|
|
106
|
+
* headers: { Authorization: `Bearer ${accessToken}` }
|
|
107
|
+
* })
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
declare const GoogleProvider: (config: GoogleConfig) => Provider<Oauth2UserData>;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { GoogleConfig, GoogleProvider };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import "../util-CSdHUFOo.js";
|
|
2
|
+
import "../error-DgAKK7b2.js";
|
|
3
|
+
import "../pkce-276Za_rZ.js";
|
|
4
|
+
import "../random-SXMYlaVr.js";
|
|
5
|
+
import { Oauth2Provider } from "../oauth2-B7-6Z7Lc.js";
|
|
6
|
+
|
|
7
|
+
//#region src/provider/google.ts
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Google OAuth 2.0 authentication provider.
|
|
10
|
+
* Use this when you need access tokens to call Google APIs on behalf of the user.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Google OAuth 2.0 configuration
|
|
13
|
+
* @returns OAuth 2.0 provider configured for Google
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* // Basic setup for user authentication
|
|
18
|
+
* const basicGoogle = GoogleProvider({
|
|
19
|
+
* clientID: process.env.GOOGLE_CLIENT_ID,
|
|
20
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // Advanced setup with API access
|
|
24
|
+
* const advancedGoogle = GoogleProvider({
|
|
25
|
+
* clientID: process.env.GOOGLE_CLIENT_ID,
|
|
26
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
|
27
|
+
* scopes: [
|
|
28
|
+
* "profile",
|
|
29
|
+
* "email",
|
|
30
|
+
* "https://www.googleapis.com/auth/calendar.readonly",
|
|
31
|
+
* "https://www.googleapis.com/auth/drive.file"
|
|
32
|
+
* ],
|
|
33
|
+
* query: {
|
|
34
|
+
* access_type: "offline", // Get refresh token
|
|
35
|
+
* prompt: "consent", // Force consent for refresh token
|
|
36
|
+
* hd: "mycompany.com" // Restrict to company domain
|
|
37
|
+
* }
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* // Use the access token for API calls
|
|
41
|
+
* success: async (ctx, value) => {
|
|
42
|
+
* const accessToken = value.tokenset.access
|
|
43
|
+
* const response = await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
|
|
44
|
+
* headers: { Authorization: `Bearer ${accessToken}` }
|
|
45
|
+
* })
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
const GoogleProvider = (config) => {
|
|
50
|
+
return Oauth2Provider({
|
|
51
|
+
...config,
|
|
52
|
+
type: "google",
|
|
53
|
+
endpoint: {
|
|
54
|
+
authorization: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
55
|
+
token: "https://oauth2.googleapis.com/token",
|
|
56
|
+
jwks: "https://www.googleapis.com/oauth2/v3/certs"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { GoogleProvider };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../storage-CxKerLlc.js";
|
|
2
|
+
import "../provider-CwWMG-1l.js";
|
|
3
|
+
import { Oauth2Config, Oauth2Provider, Oauth2Token, Oauth2UserData, Oauth2WrappedConfig } from "../oauth2-DtKwtl8p.js";
|
|
4
|
+
export { Oauth2Config, Oauth2Provider, Oauth2Token, Oauth2UserData, Oauth2WrappedConfig };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../storage-CxKerLlc.js";
|
|
2
|
+
import "../provider-CwWMG-1l.js";
|
|
3
|
+
import { PBKDF2Hasher, PasswordChangeError, PasswordChangeState, PasswordConfig, PasswordHasher, PasswordLoginError, PasswordProvider, PasswordRegisterError, PasswordRegisterState, PasswordUserData, ScryptHasher } from "../password-Cm0dRMwa.js";
|
|
4
|
+
export { PBKDF2Hasher, PasswordChangeError, PasswordChangeState, PasswordConfig, PasswordHasher, PasswordLoginError, PasswordProvider, PasswordRegisterError, PasswordRegisterState, PasswordUserData, ScryptHasher };
|