@hammadj/better-auth-core 1.5.0-beta.9
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/.turbo/turbo-build.log +266 -0
- package/.turbo/turbo-test.log +2 -0
- package/LICENSE.md +20 -0
- package/dist/api/index.d.mts +181 -0
- package/dist/api/index.mjs +34 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/async_hooks/index.d.mts +7 -0
- package/dist/async_hooks/index.mjs +22 -0
- package/dist/async_hooks/index.mjs.map +1 -0
- package/dist/async_hooks/pure.index.d.mts +7 -0
- package/dist/async_hooks/pure.index.mjs +35 -0
- package/dist/async_hooks/pure.index.mjs.map +1 -0
- package/dist/context/endpoint-context.d.mts +19 -0
- package/dist/context/endpoint-context.mjs +32 -0
- package/dist/context/endpoint-context.mjs.map +1 -0
- package/dist/context/global.d.mts +7 -0
- package/dist/context/global.mjs +38 -0
- package/dist/context/global.mjs.map +1 -0
- package/dist/context/index.d.mts +5 -0
- package/dist/context/index.mjs +6 -0
- package/dist/context/request-state.d.mts +26 -0
- package/dist/context/request-state.mjs +50 -0
- package/dist/context/request-state.mjs.map +1 -0
- package/dist/context/transaction.d.mts +25 -0
- package/dist/context/transaction.mjs +96 -0
- package/dist/context/transaction.mjs.map +1 -0
- package/dist/db/adapter/factory.d.mts +28 -0
- package/dist/db/adapter/factory.mjs +716 -0
- package/dist/db/adapter/factory.mjs.map +1 -0
- package/dist/db/adapter/get-default-field-name.d.mts +19 -0
- package/dist/db/adapter/get-default-field-name.mjs +39 -0
- package/dist/db/adapter/get-default-field-name.mjs.map +1 -0
- package/dist/db/adapter/get-default-model-name.d.mts +13 -0
- package/dist/db/adapter/get-default-model-name.mjs +33 -0
- package/dist/db/adapter/get-default-model-name.mjs.map +1 -0
- package/dist/db/adapter/get-field-attributes.d.mts +30 -0
- package/dist/db/adapter/get-field-attributes.mjs +40 -0
- package/dist/db/adapter/get-field-attributes.mjs.map +1 -0
- package/dist/db/adapter/get-field-name.d.mts +19 -0
- package/dist/db/adapter/get-field-name.mjs +34 -0
- package/dist/db/adapter/get-field-name.mjs.map +1 -0
- package/dist/db/adapter/get-id-field.d.mts +40 -0
- package/dist/db/adapter/get-id-field.mjs +68 -0
- package/dist/db/adapter/get-id-field.mjs.map +1 -0
- package/dist/db/adapter/get-model-name.d.mts +13 -0
- package/dist/db/adapter/get-model-name.mjs +24 -0
- package/dist/db/adapter/get-model-name.mjs.map +1 -0
- package/dist/db/adapter/index.d.mts +515 -0
- package/dist/db/adapter/index.mjs +10 -0
- package/dist/db/adapter/types.d.mts +140 -0
- package/dist/db/adapter/utils.d.mts +8 -0
- package/dist/db/adapter/utils.mjs +39 -0
- package/dist/db/adapter/utils.mjs.map +1 -0
- package/dist/db/get-tables.d.mts +9 -0
- package/dist/db/get-tables.mjs +267 -0
- package/dist/db/get-tables.mjs.map +1 -0
- package/dist/db/index.d.mts +10 -0
- package/dist/db/index.mjs +9 -0
- package/dist/db/plugin.d.mts +13 -0
- package/dist/db/schema/account.d.mts +27 -0
- package/dist/db/schema/account.mjs +20 -0
- package/dist/db/schema/account.mjs.map +1 -0
- package/dist/db/schema/rate-limit.d.mts +15 -0
- package/dist/db/schema/rate-limit.mjs +12 -0
- package/dist/db/schema/rate-limit.mjs.map +1 -0
- package/dist/db/schema/session.d.mts +22 -0
- package/dist/db/schema/session.mjs +15 -0
- package/dist/db/schema/session.mjs.map +1 -0
- package/dist/db/schema/shared.d.mts +11 -0
- package/dist/db/schema/shared.mjs +12 -0
- package/dist/db/schema/shared.mjs.map +1 -0
- package/dist/db/schema/user.d.mts +21 -0
- package/dist/db/schema/user.mjs +14 -0
- package/dist/db/schema/user.mjs.map +1 -0
- package/dist/db/schema/verification.d.mts +20 -0
- package/dist/db/schema/verification.mjs +13 -0
- package/dist/db/schema/verification.mjs.map +1 -0
- package/dist/db/type.d.mts +147 -0
- package/dist/env/color-depth.d.mts +5 -0
- package/dist/env/color-depth.mjs +89 -0
- package/dist/env/color-depth.mjs.map +1 -0
- package/dist/env/env-impl.d.mts +33 -0
- package/dist/env/env-impl.mjs +83 -0
- package/dist/env/env-impl.mjs.map +1 -0
- package/dist/env/index.d.mts +4 -0
- package/dist/env/index.mjs +5 -0
- package/dist/env/logger.d.mts +49 -0
- package/dist/env/logger.mjs +82 -0
- package/dist/env/logger.mjs.map +1 -0
- package/dist/error/codes.d.mts +199 -0
- package/dist/error/codes.mjs +57 -0
- package/dist/error/codes.mjs.map +1 -0
- package/dist/error/index.d.mts +20 -0
- package/dist/error/index.mjs +30 -0
- package/dist/error/index.mjs.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +1 -0
- package/dist/oauth2/client-credentials-token.d.mts +37 -0
- package/dist/oauth2/client-credentials-token.mjs +55 -0
- package/dist/oauth2/client-credentials-token.mjs.map +1 -0
- package/dist/oauth2/create-authorization-url.d.mts +46 -0
- package/dist/oauth2/create-authorization-url.mjs +43 -0
- package/dist/oauth2/create-authorization-url.mjs.map +1 -0
- package/dist/oauth2/index.d.mts +8 -0
- package/dist/oauth2/index.mjs +8 -0
- package/dist/oauth2/oauth-provider.d.mts +195 -0
- package/dist/oauth2/refresh-access-token.d.mts +36 -0
- package/dist/oauth2/refresh-access-token.mjs +59 -0
- package/dist/oauth2/refresh-access-token.mjs.map +1 -0
- package/dist/oauth2/utils.d.mts +8 -0
- package/dist/oauth2/utils.mjs +28 -0
- package/dist/oauth2/utils.mjs.map +1 -0
- package/dist/oauth2/validate-authorization-code.d.mts +56 -0
- package/dist/oauth2/validate-authorization-code.mjs +72 -0
- package/dist/oauth2/validate-authorization-code.mjs.map +1 -0
- package/dist/oauth2/verify.d.mts +43 -0
- package/dist/oauth2/verify.mjs +96 -0
- package/dist/oauth2/verify.mjs.map +1 -0
- package/dist/social-providers/apple.d.mts +120 -0
- package/dist/social-providers/apple.mjs +105 -0
- package/dist/social-providers/apple.mjs.map +1 -0
- package/dist/social-providers/atlassian.d.mts +73 -0
- package/dist/social-providers/atlassian.mjs +84 -0
- package/dist/social-providers/atlassian.mjs.map +1 -0
- package/dist/social-providers/cognito.d.mts +88 -0
- package/dist/social-providers/cognito.mjs +166 -0
- package/dist/social-providers/cognito.mjs.map +1 -0
- package/dist/social-providers/discord.d.mts +127 -0
- package/dist/social-providers/discord.mjs +65 -0
- package/dist/social-providers/discord.mjs.map +1 -0
- package/dist/social-providers/dropbox.d.mts +72 -0
- package/dist/social-providers/dropbox.mjs +76 -0
- package/dist/social-providers/dropbox.mjs.map +1 -0
- package/dist/social-providers/facebook.d.mts +82 -0
- package/dist/social-providers/facebook.mjs +121 -0
- package/dist/social-providers/facebook.mjs.map +1 -0
- package/dist/social-providers/figma.d.mts +64 -0
- package/dist/social-providers/figma.mjs +87 -0
- package/dist/social-providers/figma.mjs.map +1 -0
- package/dist/social-providers/github.d.mts +105 -0
- package/dist/social-providers/github.mjs +97 -0
- package/dist/social-providers/github.mjs.map +1 -0
- package/dist/social-providers/gitlab.d.mts +126 -0
- package/dist/social-providers/gitlab.mjs +83 -0
- package/dist/social-providers/gitlab.mjs.map +1 -0
- package/dist/social-providers/google.d.mts +100 -0
- package/dist/social-providers/google.mjs +109 -0
- package/dist/social-providers/google.mjs.map +1 -0
- package/dist/social-providers/huggingface.d.mts +86 -0
- package/dist/social-providers/huggingface.mjs +76 -0
- package/dist/social-providers/huggingface.mjs.map +1 -0
- package/dist/social-providers/index.d.mts +1725 -0
- package/dist/social-providers/index.mjs +77 -0
- package/dist/social-providers/index.mjs.map +1 -0
- package/dist/social-providers/kakao.d.mts +164 -0
- package/dist/social-providers/kakao.mjs +73 -0
- package/dist/social-providers/kakao.mjs.map +1 -0
- package/dist/social-providers/kick.d.mts +76 -0
- package/dist/social-providers/kick.mjs +72 -0
- package/dist/social-providers/kick.mjs.map +1 -0
- package/dist/social-providers/line.d.mts +108 -0
- package/dist/social-providers/line.mjs +114 -0
- package/dist/social-providers/line.mjs.map +1 -0
- package/dist/social-providers/linear.d.mts +71 -0
- package/dist/social-providers/linear.mjs +89 -0
- package/dist/social-providers/linear.mjs.map +1 -0
- package/dist/social-providers/linkedin.d.mts +70 -0
- package/dist/social-providers/linkedin.mjs +77 -0
- package/dist/social-providers/linkedin.mjs.map +1 -0
- package/dist/social-providers/microsoft-entra-id.d.mts +175 -0
- package/dist/social-providers/microsoft-entra-id.mjs +107 -0
- package/dist/social-providers/microsoft-entra-id.mjs.map +1 -0
- package/dist/social-providers/naver.d.mts +95 -0
- package/dist/social-providers/naver.mjs +68 -0
- package/dist/social-providers/naver.mjs.map +1 -0
- package/dist/social-providers/notion.d.mts +67 -0
- package/dist/social-providers/notion.mjs +76 -0
- package/dist/social-providers/notion.mjs.map +1 -0
- package/dist/social-providers/paybin.d.mts +74 -0
- package/dist/social-providers/paybin.mjs +86 -0
- package/dist/social-providers/paybin.mjs.map +1 -0
- package/dist/social-providers/paypal.d.mts +132 -0
- package/dist/social-providers/paypal.mjs +145 -0
- package/dist/social-providers/paypal.mjs.map +1 -0
- package/dist/social-providers/polar.d.mts +77 -0
- package/dist/social-providers/polar.mjs +74 -0
- package/dist/social-providers/polar.mjs.map +1 -0
- package/dist/social-providers/reddit.d.mts +65 -0
- package/dist/social-providers/reddit.mjs +84 -0
- package/dist/social-providers/reddit.mjs.map +1 -0
- package/dist/social-providers/roblox.d.mts +73 -0
- package/dist/social-providers/roblox.mjs +60 -0
- package/dist/social-providers/roblox.mjs.map +1 -0
- package/dist/social-providers/salesforce.d.mts +82 -0
- package/dist/social-providers/salesforce.mjs +92 -0
- package/dist/social-providers/salesforce.mjs.map +1 -0
- package/dist/social-providers/slack.d.mts +86 -0
- package/dist/social-providers/slack.mjs +69 -0
- package/dist/social-providers/slack.mjs.map +1 -0
- package/dist/social-providers/spotify.d.mts +66 -0
- package/dist/social-providers/spotify.mjs +72 -0
- package/dist/social-providers/spotify.mjs.map +1 -0
- package/dist/social-providers/tiktok.d.mts +171 -0
- package/dist/social-providers/tiktok.mjs +63 -0
- package/dist/social-providers/tiktok.mjs.map +1 -0
- package/dist/social-providers/twitch.d.mts +82 -0
- package/dist/social-providers/twitch.mjs +79 -0
- package/dist/social-providers/twitch.mjs.map +1 -0
- package/dist/social-providers/twitter.d.mts +129 -0
- package/dist/social-providers/twitter.mjs +88 -0
- package/dist/social-providers/twitter.mjs.map +1 -0
- package/dist/social-providers/vercel.d.mts +65 -0
- package/dist/social-providers/vercel.mjs +62 -0
- package/dist/social-providers/vercel.mjs.map +1 -0
- package/dist/social-providers/vk.d.mts +73 -0
- package/dist/social-providers/vk.mjs +84 -0
- package/dist/social-providers/vk.mjs.map +1 -0
- package/dist/social-providers/zoom.d.mts +173 -0
- package/dist/social-providers/zoom.mjs +73 -0
- package/dist/social-providers/zoom.mjs.map +1 -0
- package/dist/types/context.d.mts +267 -0
- package/dist/types/cookie.d.mts +16 -0
- package/dist/types/helper.d.mts +10 -0
- package/dist/types/index.d.mts +8 -0
- package/dist/types/init-options.d.mts +1314 -0
- package/dist/types/plugin-client.d.mts +112 -0
- package/dist/types/plugin.d.mts +125 -0
- package/dist/utils/db.d.mts +12 -0
- package/dist/utils/db.mjs +17 -0
- package/dist/utils/db.mjs.map +1 -0
- package/dist/utils/deprecate.d.mts +10 -0
- package/dist/utils/deprecate.mjs +18 -0
- package/dist/utils/deprecate.mjs.map +1 -0
- package/dist/utils/error-codes.d.mts +13 -0
- package/dist/utils/error-codes.mjs +12 -0
- package/dist/utils/error-codes.mjs.map +1 -0
- package/dist/utils/id.d.mts +5 -0
- package/dist/utils/id.mjs +10 -0
- package/dist/utils/id.mjs.map +1 -0
- package/dist/utils/ip.d.mts +55 -0
- package/dist/utils/ip.mjs +119 -0
- package/dist/utils/ip.mjs.map +1 -0
- package/dist/utils/json.d.mts +5 -0
- package/dist/utils/json.mjs +26 -0
- package/dist/utils/json.mjs.map +1 -0
- package/dist/utils/string.d.mts +5 -0
- package/dist/utils/string.mjs +8 -0
- package/dist/utils/string.mjs.map +1 -0
- package/dist/utils/url.d.mts +21 -0
- package/dist/utils/url.mjs +33 -0
- package/dist/utils/url.mjs.map +1 -0
- package/package.json +147 -0
- package/src/api/index.ts +106 -0
- package/src/async_hooks/index.ts +40 -0
- package/src/async_hooks/pure.index.ts +46 -0
- package/src/context/endpoint-context.ts +50 -0
- package/src/context/global.ts +57 -0
- package/src/context/index.ts +23 -0
- package/src/context/request-state.test.ts +94 -0
- package/src/context/request-state.ts +91 -0
- package/src/context/transaction.ts +136 -0
- package/src/db/adapter/factory.ts +1362 -0
- package/src/db/adapter/get-default-field-name.ts +59 -0
- package/src/db/adapter/get-default-model-name.ts +51 -0
- package/src/db/adapter/get-field-attributes.ts +62 -0
- package/src/db/adapter/get-field-name.ts +43 -0
- package/src/db/adapter/get-id-field.ts +141 -0
- package/src/db/adapter/get-model-name.ts +36 -0
- package/src/db/adapter/index.ts +554 -0
- package/src/db/adapter/types.ts +171 -0
- package/src/db/adapter/utils.ts +61 -0
- package/src/db/get-tables.ts +296 -0
- package/src/db/index.ts +18 -0
- package/src/db/plugin.ts +11 -0
- package/src/db/schema/account.ts +34 -0
- package/src/db/schema/rate-limit.ts +21 -0
- package/src/db/schema/session.ts +17 -0
- package/src/db/schema/shared.ts +7 -0
- package/src/db/schema/user.ts +16 -0
- package/src/db/schema/verification.ts +15 -0
- package/src/db/test/get-tables.test.ts +116 -0
- package/src/db/type.ts +180 -0
- package/src/env/color-depth.ts +172 -0
- package/src/env/env-impl.ts +124 -0
- package/src/env/index.ts +23 -0
- package/src/env/logger.test.ts +34 -0
- package/src/env/logger.ts +145 -0
- package/src/error/codes.ts +58 -0
- package/src/error/index.ts +35 -0
- package/src/index.ts +1 -0
- package/src/oauth2/client-credentials-token.ts +102 -0
- package/src/oauth2/create-authorization-url.ts +87 -0
- package/src/oauth2/index.ts +26 -0
- package/src/oauth2/oauth-provider.ts +222 -0
- package/src/oauth2/refresh-access-token.ts +124 -0
- package/src/oauth2/utils.ts +38 -0
- package/src/oauth2/validate-authorization-code.ts +149 -0
- package/src/oauth2/validate-token.test.ts +174 -0
- package/src/oauth2/verify.ts +221 -0
- package/src/social-providers/apple.ts +223 -0
- package/src/social-providers/atlassian.ts +132 -0
- package/src/social-providers/cognito.ts +279 -0
- package/src/social-providers/discord.ts +169 -0
- package/src/social-providers/dropbox.ts +112 -0
- package/src/social-providers/facebook.ts +206 -0
- package/src/social-providers/figma.ts +117 -0
- package/src/social-providers/github.ts +184 -0
- package/src/social-providers/gitlab.ts +155 -0
- package/src/social-providers/google.ts +199 -0
- package/src/social-providers/huggingface.ts +118 -0
- package/src/social-providers/index.ts +127 -0
- package/src/social-providers/kakao.ts +178 -0
- package/src/social-providers/kick.ts +109 -0
- package/src/social-providers/line.ts +169 -0
- package/src/social-providers/linear.ts +121 -0
- package/src/social-providers/linkedin.ts +110 -0
- package/src/social-providers/microsoft-entra-id.ts +259 -0
- package/src/social-providers/naver.ts +112 -0
- package/src/social-providers/notion.ts +108 -0
- package/src/social-providers/paybin.ts +122 -0
- package/src/social-providers/paypal.ts +263 -0
- package/src/social-providers/polar.ts +110 -0
- package/src/social-providers/reddit.ts +122 -0
- package/src/social-providers/roblox.ts +111 -0
- package/src/social-providers/salesforce.ts +159 -0
- package/src/social-providers/slack.ts +111 -0
- package/src/social-providers/spotify.ts +93 -0
- package/src/social-providers/tiktok.ts +209 -0
- package/src/social-providers/twitch.ts +111 -0
- package/src/social-providers/twitter.ts +198 -0
- package/src/social-providers/vercel.ts +87 -0
- package/src/social-providers/vk.ts +124 -0
- package/src/social-providers/zoom.ts +238 -0
- package/src/types/context.ts +396 -0
- package/src/types/cookie.ts +10 -0
- package/src/types/helper.ts +26 -0
- package/src/types/index.ts +32 -0
- package/src/types/init-options.ts +1529 -0
- package/src/types/plugin-client.ts +127 -0
- package/src/types/plugin.ts +157 -0
- package/src/utils/db.ts +20 -0
- package/src/utils/deprecate.test.ts +72 -0
- package/src/utils/deprecate.ts +21 -0
- package/src/utils/error-codes.ts +65 -0
- package/src/utils/id.ts +5 -0
- package/src/utils/ip.test.ts +255 -0
- package/src/utils/ip.ts +211 -0
- package/src/utils/json.ts +25 -0
- package/src/utils/string.ts +3 -0
- package/src/utils/url.ts +43 -0
- package/tsconfig.json +7 -0
- package/tsdown.config.ts +35 -0
- package/vitest.config.ts +3 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
|
+
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
|
+
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
5
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
+
import { decodeJwt } from "jose";
|
|
7
|
+
|
|
8
|
+
//#region src/social-providers/line.ts
|
|
9
|
+
/**
|
|
10
|
+
* LINE Login v2.1
|
|
11
|
+
* - Authorization endpoint: https://access.line.me/oauth2/v2.1/authorize
|
|
12
|
+
* - Token endpoint: https://api.line.me/oauth2/v2.1/token
|
|
13
|
+
* - UserInfo endpoint: https://api.line.me/oauth2/v2.1/userinfo
|
|
14
|
+
* - Verify ID token: https://api.line.me/oauth2/v2.1/verify
|
|
15
|
+
*
|
|
16
|
+
* Docs: https://developers.line.biz/en/reference/line-login/#issue-access-token
|
|
17
|
+
*/
|
|
18
|
+
const line = (options) => {
|
|
19
|
+
const authorizationEndpoint = "https://access.line.me/oauth2/v2.1/authorize";
|
|
20
|
+
const tokenEndpoint = "https://api.line.me/oauth2/v2.1/token";
|
|
21
|
+
const userInfoEndpoint = "https://api.line.me/oauth2/v2.1/userinfo";
|
|
22
|
+
const verifyIdTokenEndpoint = "https://api.line.me/oauth2/v2.1/verify";
|
|
23
|
+
return {
|
|
24
|
+
id: "line",
|
|
25
|
+
name: "LINE",
|
|
26
|
+
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint }) {
|
|
27
|
+
const _scopes = options.disableDefaultScope ? [] : [
|
|
28
|
+
"openid",
|
|
29
|
+
"profile",
|
|
30
|
+
"email"
|
|
31
|
+
];
|
|
32
|
+
if (options.scope) _scopes.push(...options.scope);
|
|
33
|
+
if (scopes) _scopes.push(...scopes);
|
|
34
|
+
return await createAuthorizationURL({
|
|
35
|
+
id: "line",
|
|
36
|
+
options,
|
|
37
|
+
authorizationEndpoint,
|
|
38
|
+
scopes: _scopes,
|
|
39
|
+
state,
|
|
40
|
+
codeVerifier,
|
|
41
|
+
redirectURI,
|
|
42
|
+
loginHint
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
46
|
+
return validateAuthorizationCode({
|
|
47
|
+
code,
|
|
48
|
+
codeVerifier,
|
|
49
|
+
redirectURI,
|
|
50
|
+
options,
|
|
51
|
+
tokenEndpoint
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
|
|
55
|
+
return refreshAccessToken({
|
|
56
|
+
refreshToken,
|
|
57
|
+
options: {
|
|
58
|
+
clientId: options.clientId,
|
|
59
|
+
clientSecret: options.clientSecret
|
|
60
|
+
},
|
|
61
|
+
tokenEndpoint
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
async verifyIdToken(token, nonce) {
|
|
65
|
+
if (options.disableIdTokenSignIn) return false;
|
|
66
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
67
|
+
const body = new URLSearchParams();
|
|
68
|
+
body.set("id_token", token);
|
|
69
|
+
body.set("client_id", options.clientId);
|
|
70
|
+
if (nonce) body.set("nonce", nonce);
|
|
71
|
+
const { data, error } = await betterFetch(verifyIdTokenEndpoint, {
|
|
72
|
+
method: "POST",
|
|
73
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
74
|
+
body
|
|
75
|
+
});
|
|
76
|
+
if (error || !data) return false;
|
|
77
|
+
if (data.aud !== options.clientId) return false;
|
|
78
|
+
if (data.nonce && data.nonce !== nonce) return false;
|
|
79
|
+
return true;
|
|
80
|
+
},
|
|
81
|
+
async getUserInfo(token) {
|
|
82
|
+
if (options.getUserInfo) return options.getUserInfo(token);
|
|
83
|
+
let profile = null;
|
|
84
|
+
if (token.idToken) try {
|
|
85
|
+
profile = decodeJwt(token.idToken);
|
|
86
|
+
} catch {}
|
|
87
|
+
if (!profile) {
|
|
88
|
+
const { data } = await betterFetch(userInfoEndpoint, { headers: { authorization: `Bearer ${token.accessToken}` } });
|
|
89
|
+
profile = data || null;
|
|
90
|
+
}
|
|
91
|
+
if (!profile) return null;
|
|
92
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
93
|
+
const id = profile.sub || profile.userId;
|
|
94
|
+
const name = profile.name || profile.displayName;
|
|
95
|
+
const image = profile.picture || profile.pictureUrl || void 0;
|
|
96
|
+
return {
|
|
97
|
+
user: {
|
|
98
|
+
id,
|
|
99
|
+
name,
|
|
100
|
+
email: profile.email,
|
|
101
|
+
image,
|
|
102
|
+
emailVerified: false,
|
|
103
|
+
...userMap
|
|
104
|
+
},
|
|
105
|
+
data: profile
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
options
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { line };
|
|
114
|
+
//# sourceMappingURL=line.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.mjs","names":[],"sources":["../../src/social-providers/line.ts"],"sourcesContent":["import { betterFetch } from \"@better-fetch/fetch\";\nimport { decodeJwt } from \"jose\";\nimport type { OAuthProvider, ProviderOptions } from \"../oauth2\";\nimport {\n\tcreateAuthorizationURL,\n\trefreshAccessToken,\n\tvalidateAuthorizationCode,\n} from \"../oauth2\";\n\nexport interface LineIdTokenPayload {\n\tiss: string;\n\tsub: string;\n\taud: string;\n\texp: number;\n\tiat: number;\n\tname?: string | undefined;\n\tpicture?: string | undefined;\n\temail?: string | undefined;\n\tamr?: string[] | undefined;\n\tnonce?: string | undefined;\n}\n\nexport interface LineUserInfo {\n\tsub: string;\n\tname?: string | undefined;\n\tpicture?: string | undefined;\n\temail?: string | undefined;\n}\n\nexport interface LineOptions\n\textends ProviderOptions<LineUserInfo | LineIdTokenPayload> {\n\tclientId: string;\n}\n\n/**\n * LINE Login v2.1\n * - Authorization endpoint: https://access.line.me/oauth2/v2.1/authorize\n * - Token endpoint: https://api.line.me/oauth2/v2.1/token\n * - UserInfo endpoint: https://api.line.me/oauth2/v2.1/userinfo\n * - Verify ID token: https://api.line.me/oauth2/v2.1/verify\n *\n * Docs: https://developers.line.biz/en/reference/line-login/#issue-access-token\n */\nexport const line = (options: LineOptions) => {\n\tconst authorizationEndpoint = \"https://access.line.me/oauth2/v2.1/authorize\";\n\tconst tokenEndpoint = \"https://api.line.me/oauth2/v2.1/token\";\n\tconst userInfoEndpoint = \"https://api.line.me/oauth2/v2.1/userinfo\";\n\tconst verifyIdTokenEndpoint = \"https://api.line.me/oauth2/v2.1/verify\";\n\n\treturn {\n\t\tid: \"line\",\n\t\tname: \"LINE\",\n\t\tasync createAuthorizationURL({\n\t\t\tstate,\n\t\t\tscopes,\n\t\t\tcodeVerifier,\n\t\t\tredirectURI,\n\t\t\tloginHint,\n\t\t}) {\n\t\t\tconst _scopes = options.disableDefaultScope\n\t\t\t\t? []\n\t\t\t\t: [\"openid\", \"profile\", \"email\"];\n\t\t\tif (options.scope) _scopes.push(...options.scope);\n\t\t\tif (scopes) _scopes.push(...scopes);\n\t\t\treturn await createAuthorizationURL({\n\t\t\t\tid: \"line\",\n\t\t\t\toptions,\n\t\t\t\tauthorizationEndpoint,\n\t\t\t\tscopes: _scopes,\n\t\t\t\tstate,\n\t\t\t\tcodeVerifier,\n\t\t\t\tredirectURI,\n\t\t\t\tloginHint,\n\t\t\t});\n\t\t},\n\t\tvalidateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {\n\t\t\treturn validateAuthorizationCode({\n\t\t\t\tcode,\n\t\t\t\tcodeVerifier,\n\t\t\t\tredirectURI,\n\t\t\t\toptions,\n\t\t\t\ttokenEndpoint,\n\t\t\t});\n\t\t},\n\t\trefreshAccessToken: options.refreshAccessToken\n\t\t\t? options.refreshAccessToken\n\t\t\t: async (refreshToken) => {\n\t\t\t\t\treturn refreshAccessToken({\n\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tclientId: options.clientId,\n\t\t\t\t\t\t\tclientSecret: options.clientSecret,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttokenEndpoint,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\tasync verifyIdToken(token, nonce) {\n\t\t\tif (options.disableIdTokenSignIn) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (options.verifyIdToken) {\n\t\t\t\treturn options.verifyIdToken(token, nonce);\n\t\t\t}\n\t\t\tconst body = new URLSearchParams();\n\t\t\tbody.set(\"id_token\", token);\n\t\t\tbody.set(\"client_id\", options.clientId);\n\t\t\tif (nonce) body.set(\"nonce\", nonce);\n\t\t\tconst { data, error } = await betterFetch<LineIdTokenPayload>(\n\t\t\t\tverifyIdTokenEndpoint,\n\t\t\t\t{\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"content-type\": \"application/x-www-form-urlencoded\",\n\t\t\t\t\t},\n\t\t\t\t\tbody,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (error || !data) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// aud must match clientId; nonce (if provided) must also match nonce\n\t\t\tif (data.aud !== options.clientId) return false;\n\t\t\tif (data.nonce && data.nonce !== nonce) return false;\n\t\t\treturn true;\n\t\t},\n\t\tasync getUserInfo(token) {\n\t\t\tif (options.getUserInfo) {\n\t\t\t\treturn options.getUserInfo(token);\n\t\t\t}\n\t\t\tlet profile: LineUserInfo | LineIdTokenPayload | null = null;\n\t\t\t// Prefer ID token if available\n\t\t\tif (token.idToken) {\n\t\t\t\ttry {\n\t\t\t\t\tprofile = decodeJwt(token.idToken) as LineIdTokenPayload;\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\t// Fallback to UserInfo endpoint\n\t\t\tif (!profile) {\n\t\t\t\tconst { data } = await betterFetch<LineUserInfo>(userInfoEndpoint, {\n\t\t\t\t\theaders: {\n\t\t\t\t\t\tauthorization: `Bearer ${token.accessToken}`,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tprofile = data || null;\n\t\t\t}\n\t\t\tif (!profile) return null;\n\t\t\tconst userMap = await options.mapProfileToUser?.(profile as any);\n\t\t\t// ID preference order\n\t\t\tconst id = (profile as any).sub || (profile as any).userId;\n\t\t\tconst name = (profile as any).name || (profile as any).displayName;\n\t\t\tconst image =\n\t\t\t\t(profile as any).picture || (profile as any).pictureUrl || undefined;\n\t\t\tconst email = (profile as any).email;\n\t\t\treturn {\n\t\t\t\tuser: {\n\t\t\t\t\tid,\n\t\t\t\t\tname,\n\t\t\t\t\temail,\n\t\t\t\t\timage,\n\t\t\t\t\t// LINE does not expose email verification status in ID token/userinfo\n\t\t\t\t\temailVerified: false,\n\t\t\t\t\t...userMap,\n\t\t\t\t},\n\t\t\t\tdata: profile as any,\n\t\t\t};\n\t\t},\n\t\toptions,\n\t} satisfies OAuthProvider<LineUserInfo | LineIdTokenPayload, LineOptions>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,MAAa,QAAQ,YAAyB;CAC7C,MAAM,wBAAwB;CAC9B,MAAM,gBAAgB;CACtB,MAAM,mBAAmB;CACzB,MAAM,wBAAwB;AAE9B,QAAO;EACN,IAAI;EACJ,MAAM;EACN,MAAM,uBAAuB,EAC5B,OACA,QACA,cACA,aACA,aACE;GACF,MAAM,UAAU,QAAQ,sBACrB,EAAE,GACF;IAAC;IAAU;IAAW;IAAQ;AACjC,OAAI,QAAQ,MAAO,SAAQ,KAAK,GAAG,QAAQ,MAAM;AACjD,OAAI,OAAQ,SAAQ,KAAK,GAAG,OAAO;AACnC,UAAO,MAAM,uBAAuB;IACnC,IAAI;IACJ;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA;IACA,CAAC;;EAEH,2BAA2B,OAAO,EAAE,MAAM,cAAc,kBAAkB;AACzE,UAAO,0BAA0B;IAChC;IACA;IACA;IACA;IACA;IACA,CAAC;;EAEH,oBAAoB,QAAQ,qBACzB,QAAQ,qBACR,OAAO,iBAAiB;AACxB,UAAO,mBAAmB;IACzB;IACA,SAAS;KACR,UAAU,QAAQ;KAClB,cAAc,QAAQ;KACtB;IACD;IACA,CAAC;;EAEL,MAAM,cAAc,OAAO,OAAO;AACjC,OAAI,QAAQ,qBACX,QAAO;AAER,OAAI,QAAQ,cACX,QAAO,QAAQ,cAAc,OAAO,MAAM;GAE3C,MAAM,OAAO,IAAI,iBAAiB;AAClC,QAAK,IAAI,YAAY,MAAM;AAC3B,QAAK,IAAI,aAAa,QAAQ,SAAS;AACvC,OAAI,MAAO,MAAK,IAAI,SAAS,MAAM;GACnC,MAAM,EAAE,MAAM,UAAU,MAAM,YAC7B,uBACA;IACC,QAAQ;IACR,SAAS,EACR,gBAAgB,qCAChB;IACD;IACA,CACD;AACD,OAAI,SAAS,CAAC,KACb,QAAO;AAGR,OAAI,KAAK,QAAQ,QAAQ,SAAU,QAAO;AAC1C,OAAI,KAAK,SAAS,KAAK,UAAU,MAAO,QAAO;AAC/C,UAAO;;EAER,MAAM,YAAY,OAAO;AACxB,OAAI,QAAQ,YACX,QAAO,QAAQ,YAAY,MAAM;GAElC,IAAI,UAAoD;AAExD,OAAI,MAAM,QACT,KAAI;AACH,cAAU,UAAU,MAAM,QAAQ;WAC3B;AAGT,OAAI,CAAC,SAAS;IACb,MAAM,EAAE,SAAS,MAAM,YAA0B,kBAAkB,EAClE,SAAS,EACR,eAAe,UAAU,MAAM,eAC/B,EACD,CAAC;AACF,cAAU,QAAQ;;AAEnB,OAAI,CAAC,QAAS,QAAO;GACrB,MAAM,UAAU,MAAM,QAAQ,mBAAmB,QAAe;GAEhE,MAAM,KAAM,QAAgB,OAAQ,QAAgB;GACpD,MAAM,OAAQ,QAAgB,QAAS,QAAgB;GACvD,MAAM,QACJ,QAAgB,WAAY,QAAgB,cAAc;AAE5D,UAAO;IACN,MAAM;KACL;KACA;KACA,OALa,QAAgB;KAM7B;KAEA,eAAe;KACf,GAAG;KACH;IACD,MAAM;IACN;;EAEF;EACA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/social-providers/linear.d.ts
|
|
5
|
+
interface LinearUser {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
avatarUrl?: string | undefined;
|
|
10
|
+
active: boolean;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
}
|
|
14
|
+
interface LinearProfile {
|
|
15
|
+
data: {
|
|
16
|
+
viewer: LinearUser;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface LinearOptions extends ProviderOptions<LinearUser> {
|
|
20
|
+
clientId: string;
|
|
21
|
+
}
|
|
22
|
+
declare const linear: (options: LinearOptions) => {
|
|
23
|
+
id: "linear";
|
|
24
|
+
name: string;
|
|
25
|
+
createAuthorizationURL({
|
|
26
|
+
state,
|
|
27
|
+
scopes,
|
|
28
|
+
loginHint,
|
|
29
|
+
redirectURI
|
|
30
|
+
}: {
|
|
31
|
+
state: string;
|
|
32
|
+
codeVerifier: string;
|
|
33
|
+
scopes?: string[] | undefined;
|
|
34
|
+
redirectURI: string;
|
|
35
|
+
display?: string | undefined;
|
|
36
|
+
loginHint?: string | undefined;
|
|
37
|
+
}): Promise<URL>;
|
|
38
|
+
validateAuthorizationCode: ({
|
|
39
|
+
code,
|
|
40
|
+
redirectURI
|
|
41
|
+
}: {
|
|
42
|
+
code: string;
|
|
43
|
+
redirectURI: string;
|
|
44
|
+
codeVerifier?: string | undefined;
|
|
45
|
+
deviceId?: string | undefined;
|
|
46
|
+
}) => Promise<OAuth2Tokens>;
|
|
47
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
48
|
+
getUserInfo(token: OAuth2Tokens & {
|
|
49
|
+
user?: {
|
|
50
|
+
name?: {
|
|
51
|
+
firstName?: string;
|
|
52
|
+
lastName?: string;
|
|
53
|
+
};
|
|
54
|
+
email?: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
user: {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
email?: string | null;
|
|
61
|
+
image?: string;
|
|
62
|
+
emailVerified: boolean;
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
};
|
|
65
|
+
data: any;
|
|
66
|
+
} | null>;
|
|
67
|
+
options: LinearOptions;
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { LinearOptions, LinearProfile, LinearUser, linear };
|
|
71
|
+
//# sourceMappingURL=linear.d.mts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
|
+
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
|
+
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
5
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
+
|
|
7
|
+
//#region src/social-providers/linear.ts
|
|
8
|
+
const linear = (options) => {
|
|
9
|
+
const tokenEndpoint = "https://api.linear.app/oauth/token";
|
|
10
|
+
return {
|
|
11
|
+
id: "linear",
|
|
12
|
+
name: "Linear",
|
|
13
|
+
createAuthorizationURL({ state, scopes, loginHint, redirectURI }) {
|
|
14
|
+
const _scopes = options.disableDefaultScope ? [] : ["read"];
|
|
15
|
+
if (options.scope) _scopes.push(...options.scope);
|
|
16
|
+
if (scopes) _scopes.push(...scopes);
|
|
17
|
+
return createAuthorizationURL({
|
|
18
|
+
id: "linear",
|
|
19
|
+
options,
|
|
20
|
+
authorizationEndpoint: "https://linear.app/oauth/authorize",
|
|
21
|
+
scopes: _scopes,
|
|
22
|
+
state,
|
|
23
|
+
redirectURI,
|
|
24
|
+
loginHint
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
28
|
+
return validateAuthorizationCode({
|
|
29
|
+
code,
|
|
30
|
+
redirectURI,
|
|
31
|
+
options,
|
|
32
|
+
tokenEndpoint
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
|
|
36
|
+
return refreshAccessToken({
|
|
37
|
+
refreshToken,
|
|
38
|
+
options: {
|
|
39
|
+
clientId: options.clientId,
|
|
40
|
+
clientKey: options.clientKey,
|
|
41
|
+
clientSecret: options.clientSecret
|
|
42
|
+
},
|
|
43
|
+
tokenEndpoint
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
async getUserInfo(token) {
|
|
47
|
+
if (options.getUserInfo) return options.getUserInfo(token);
|
|
48
|
+
const { data: profile, error } = await betterFetch("https://api.linear.app/graphql", {
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: {
|
|
51
|
+
"Content-Type": "application/json",
|
|
52
|
+
Authorization: `Bearer ${token.accessToken}`
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify({ query: `
|
|
55
|
+
query {
|
|
56
|
+
viewer {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
email
|
|
60
|
+
avatarUrl
|
|
61
|
+
active
|
|
62
|
+
createdAt
|
|
63
|
+
updatedAt
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
` })
|
|
67
|
+
});
|
|
68
|
+
if (error || !profile?.data?.viewer) return null;
|
|
69
|
+
const userData = profile.data.viewer;
|
|
70
|
+
const userMap = await options.mapProfileToUser?.(userData);
|
|
71
|
+
return {
|
|
72
|
+
user: {
|
|
73
|
+
id: profile.data.viewer.id,
|
|
74
|
+
name: profile.data.viewer.name,
|
|
75
|
+
email: profile.data.viewer.email,
|
|
76
|
+
image: profile.data.viewer.avatarUrl,
|
|
77
|
+
emailVerified: false,
|
|
78
|
+
...userMap
|
|
79
|
+
},
|
|
80
|
+
data: userData
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
options
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { linear };
|
|
89
|
+
//# sourceMappingURL=linear.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear.mjs","names":[],"sources":["../../src/social-providers/linear.ts"],"sourcesContent":["import { betterFetch } from \"@better-fetch/fetch\";\nimport type { OAuthProvider, ProviderOptions } from \"../oauth2\";\nimport {\n\tcreateAuthorizationURL,\n\trefreshAccessToken,\n\tvalidateAuthorizationCode,\n} from \"../oauth2\";\n\nexport interface LinearUser {\n\tid: string;\n\tname: string;\n\temail: string;\n\tavatarUrl?: string | undefined;\n\tactive: boolean;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface LinearProfile {\n\tdata: {\n\t\tviewer: LinearUser;\n\t};\n}\n\nexport interface LinearOptions extends ProviderOptions<LinearUser> {\n\tclientId: string;\n}\n\nexport const linear = (options: LinearOptions) => {\n\tconst tokenEndpoint = \"https://api.linear.app/oauth/token\";\n\treturn {\n\t\tid: \"linear\",\n\t\tname: \"Linear\",\n\t\tcreateAuthorizationURL({ state, scopes, loginHint, redirectURI }) {\n\t\t\tconst _scopes = options.disableDefaultScope ? [] : [\"read\"];\n\t\t\tif (options.scope) _scopes.push(...options.scope);\n\t\t\tif (scopes) _scopes.push(...scopes);\n\t\t\treturn createAuthorizationURL({\n\t\t\t\tid: \"linear\",\n\t\t\t\toptions,\n\t\t\t\tauthorizationEndpoint: \"https://linear.app/oauth/authorize\",\n\t\t\t\tscopes: _scopes,\n\t\t\t\tstate,\n\t\t\t\tredirectURI,\n\t\t\t\tloginHint,\n\t\t\t});\n\t\t},\n\t\tvalidateAuthorizationCode: async ({ code, redirectURI }) => {\n\t\t\treturn validateAuthorizationCode({\n\t\t\t\tcode,\n\t\t\t\tredirectURI,\n\t\t\t\toptions,\n\t\t\t\ttokenEndpoint,\n\t\t\t});\n\t\t},\n\t\trefreshAccessToken: options.refreshAccessToken\n\t\t\t? options.refreshAccessToken\n\t\t\t: async (refreshToken) => {\n\t\t\t\t\treturn refreshAccessToken({\n\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tclientId: options.clientId,\n\t\t\t\t\t\t\tclientKey: options.clientKey,\n\t\t\t\t\t\t\tclientSecret: options.clientSecret,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttokenEndpoint,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\tasync getUserInfo(token) {\n\t\t\tif (options.getUserInfo) {\n\t\t\t\treturn options.getUserInfo(token);\n\t\t\t}\n\n\t\t\tconst { data: profile, error } = await betterFetch<LinearProfile>(\n\t\t\t\t\"https://api.linear.app/graphql\",\n\t\t\t\t{\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t\tAuthorization: `Bearer ${token.accessToken}`,\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tquery: `\n\t\t\t\t\t\t\tquery {\n\t\t\t\t\t\t\t\tviewer {\n\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\temail\n\t\t\t\t\t\t\t\t\tavatarUrl\n\t\t\t\t\t\t\t\t\tactive\n\t\t\t\t\t\t\t\t\tcreatedAt\n\t\t\t\t\t\t\t\t\tupdatedAt\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t`,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (error || !profile?.data?.viewer) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst userData = profile.data.viewer;\n\t\t\tconst userMap = await options.mapProfileToUser?.(userData);\n\t\t\t// Linear does not provide email_verified claim.\n\t\t\t// We default to false for security consistency.\n\t\t\treturn {\n\t\t\t\tuser: {\n\t\t\t\t\tid: profile.data.viewer.id,\n\t\t\t\t\tname: profile.data.viewer.name,\n\t\t\t\t\temail: profile.data.viewer.email,\n\t\t\t\t\timage: profile.data.viewer.avatarUrl,\n\t\t\t\t\temailVerified: false,\n\t\t\t\t\t...userMap,\n\t\t\t\t},\n\t\t\t\tdata: userData,\n\t\t\t};\n\t\t},\n\t\toptions,\n\t} satisfies OAuthProvider<LinearUser>;\n};\n"],"mappings":";;;;;;;AA4BA,MAAa,UAAU,YAA2B;CACjD,MAAM,gBAAgB;AACtB,QAAO;EACN,IAAI;EACJ,MAAM;EACN,uBAAuB,EAAE,OAAO,QAAQ,WAAW,eAAe;GACjE,MAAM,UAAU,QAAQ,sBAAsB,EAAE,GAAG,CAAC,OAAO;AAC3D,OAAI,QAAQ,MAAO,SAAQ,KAAK,GAAG,QAAQ,MAAM;AACjD,OAAI,OAAQ,SAAQ,KAAK,GAAG,OAAO;AACnC,UAAO,uBAAuB;IAC7B,IAAI;IACJ;IACA,uBAAuB;IACvB,QAAQ;IACR;IACA;IACA;IACA,CAAC;;EAEH,2BAA2B,OAAO,EAAE,MAAM,kBAAkB;AAC3D,UAAO,0BAA0B;IAChC;IACA;IACA;IACA;IACA,CAAC;;EAEH,oBAAoB,QAAQ,qBACzB,QAAQ,qBACR,OAAO,iBAAiB;AACxB,UAAO,mBAAmB;IACzB;IACA,SAAS;KACR,UAAU,QAAQ;KAClB,WAAW,QAAQ;KACnB,cAAc,QAAQ;KACtB;IACD;IACA,CAAC;;EAEL,MAAM,YAAY,OAAO;AACxB,OAAI,QAAQ,YACX,QAAO,QAAQ,YAAY,MAAM;GAGlC,MAAM,EAAE,MAAM,SAAS,UAAU,MAAM,YACtC,kCACA;IACC,QAAQ;IACR,SAAS;KACR,gBAAgB;KAChB,eAAe,UAAU,MAAM;KAC/B;IACD,MAAM,KAAK,UAAU,EACpB,OAAO;;;;;;;;;;;;SAaP,CAAC;IACF,CACD;AACD,OAAI,SAAS,CAAC,SAAS,MAAM,OAC5B,QAAO;GAGR,MAAM,WAAW,QAAQ,KAAK;GAC9B,MAAM,UAAU,MAAM,QAAQ,mBAAmB,SAAS;AAG1D,UAAO;IACN,MAAM;KACL,IAAI,QAAQ,KAAK,OAAO;KACxB,MAAM,QAAQ,KAAK,OAAO;KAC1B,OAAO,QAAQ,KAAK,OAAO;KAC3B,OAAO,QAAQ,KAAK,OAAO;KAC3B,eAAe;KACf,GAAG;KACH;IACD,MAAM;IACN;;EAEF;EACA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/social-providers/linkedin.d.ts
|
|
5
|
+
interface LinkedInProfile {
|
|
6
|
+
sub: string;
|
|
7
|
+
name: string;
|
|
8
|
+
given_name: string;
|
|
9
|
+
family_name: string;
|
|
10
|
+
picture: string;
|
|
11
|
+
locale: {
|
|
12
|
+
country: string;
|
|
13
|
+
language: string;
|
|
14
|
+
};
|
|
15
|
+
email: string;
|
|
16
|
+
email_verified: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
|
|
19
|
+
clientId: string;
|
|
20
|
+
}
|
|
21
|
+
declare const linkedin: (options: LinkedInOptions) => {
|
|
22
|
+
id: "linkedin";
|
|
23
|
+
name: string;
|
|
24
|
+
createAuthorizationURL: ({
|
|
25
|
+
state,
|
|
26
|
+
scopes,
|
|
27
|
+
redirectURI,
|
|
28
|
+
loginHint
|
|
29
|
+
}: {
|
|
30
|
+
state: string;
|
|
31
|
+
codeVerifier: string;
|
|
32
|
+
scopes?: string[] | undefined;
|
|
33
|
+
redirectURI: string;
|
|
34
|
+
display?: string | undefined;
|
|
35
|
+
loginHint?: string | undefined;
|
|
36
|
+
}) => Promise<URL>;
|
|
37
|
+
validateAuthorizationCode: ({
|
|
38
|
+
code,
|
|
39
|
+
redirectURI
|
|
40
|
+
}: {
|
|
41
|
+
code: string;
|
|
42
|
+
redirectURI: string;
|
|
43
|
+
codeVerifier?: string | undefined;
|
|
44
|
+
deviceId?: string | undefined;
|
|
45
|
+
}) => Promise<OAuth2Tokens>;
|
|
46
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
47
|
+
getUserInfo(token: OAuth2Tokens & {
|
|
48
|
+
user?: {
|
|
49
|
+
name?: {
|
|
50
|
+
firstName?: string;
|
|
51
|
+
lastName?: string;
|
|
52
|
+
};
|
|
53
|
+
email?: string;
|
|
54
|
+
} | undefined;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
user: {
|
|
57
|
+
id: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
email?: string | null;
|
|
60
|
+
image?: string;
|
|
61
|
+
emailVerified: boolean;
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
};
|
|
64
|
+
data: any;
|
|
65
|
+
} | null>;
|
|
66
|
+
options: LinkedInOptions;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { LinkedInOptions, LinkedInProfile, linkedin };
|
|
70
|
+
//# sourceMappingURL=linkedin.d.mts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
|
+
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
|
+
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
5
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
+
|
|
7
|
+
//#region src/social-providers/linkedin.ts
|
|
8
|
+
const linkedin = (options) => {
|
|
9
|
+
const authorizationEndpoint = "https://www.linkedin.com/oauth/v2/authorization";
|
|
10
|
+
const tokenEndpoint = "https://www.linkedin.com/oauth/v2/accessToken";
|
|
11
|
+
return {
|
|
12
|
+
id: "linkedin",
|
|
13
|
+
name: "Linkedin",
|
|
14
|
+
createAuthorizationURL: async ({ state, scopes, redirectURI, loginHint }) => {
|
|
15
|
+
const _scopes = options.disableDefaultScope ? [] : [
|
|
16
|
+
"profile",
|
|
17
|
+
"email",
|
|
18
|
+
"openid"
|
|
19
|
+
];
|
|
20
|
+
if (options.scope) _scopes.push(...options.scope);
|
|
21
|
+
if (scopes) _scopes.push(...scopes);
|
|
22
|
+
return await createAuthorizationURL({
|
|
23
|
+
id: "linkedin",
|
|
24
|
+
options,
|
|
25
|
+
authorizationEndpoint,
|
|
26
|
+
scopes: _scopes,
|
|
27
|
+
state,
|
|
28
|
+
loginHint,
|
|
29
|
+
redirectURI
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
33
|
+
return await validateAuthorizationCode({
|
|
34
|
+
code,
|
|
35
|
+
redirectURI,
|
|
36
|
+
options,
|
|
37
|
+
tokenEndpoint
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
|
|
41
|
+
return refreshAccessToken({
|
|
42
|
+
refreshToken,
|
|
43
|
+
options: {
|
|
44
|
+
clientId: options.clientId,
|
|
45
|
+
clientKey: options.clientKey,
|
|
46
|
+
clientSecret: options.clientSecret
|
|
47
|
+
},
|
|
48
|
+
tokenEndpoint
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
async getUserInfo(token) {
|
|
52
|
+
if (options.getUserInfo) return options.getUserInfo(token);
|
|
53
|
+
const { data: profile, error } = await betterFetch("https://api.linkedin.com/v2/userinfo", {
|
|
54
|
+
method: "GET",
|
|
55
|
+
headers: { Authorization: `Bearer ${token.accessToken}` }
|
|
56
|
+
});
|
|
57
|
+
if (error) return null;
|
|
58
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
59
|
+
return {
|
|
60
|
+
user: {
|
|
61
|
+
id: profile.sub,
|
|
62
|
+
name: profile.name,
|
|
63
|
+
email: profile.email,
|
|
64
|
+
emailVerified: profile.email_verified || false,
|
|
65
|
+
image: profile.picture,
|
|
66
|
+
...userMap
|
|
67
|
+
},
|
|
68
|
+
data: profile
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
options
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { linkedin };
|
|
77
|
+
//# sourceMappingURL=linkedin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin.mjs","names":[],"sources":["../../src/social-providers/linkedin.ts"],"sourcesContent":["import { betterFetch } from \"@better-fetch/fetch\";\nimport type { OAuthProvider, ProviderOptions } from \"../oauth2\";\nimport {\n\tcreateAuthorizationURL,\n\trefreshAccessToken,\n\tvalidateAuthorizationCode,\n} from \"../oauth2\";\n\nexport interface LinkedInProfile {\n\tsub: string;\n\tname: string;\n\tgiven_name: string;\n\tfamily_name: string;\n\tpicture: string;\n\tlocale: {\n\t\tcountry: string;\n\t\tlanguage: string;\n\t};\n\temail: string;\n\temail_verified: boolean;\n}\n\nexport interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {\n\tclientId: string;\n}\n\nexport const linkedin = (options: LinkedInOptions) => {\n\tconst authorizationEndpoint =\n\t\t\"https://www.linkedin.com/oauth/v2/authorization\";\n\tconst tokenEndpoint = \"https://www.linkedin.com/oauth/v2/accessToken\";\n\n\treturn {\n\t\tid: \"linkedin\",\n\t\tname: \"Linkedin\",\n\t\tcreateAuthorizationURL: async ({\n\t\t\tstate,\n\t\t\tscopes,\n\t\t\tredirectURI,\n\t\t\tloginHint,\n\t\t}) => {\n\t\t\tconst _scopes = options.disableDefaultScope\n\t\t\t\t? []\n\t\t\t\t: [\"profile\", \"email\", \"openid\"];\n\t\t\tif (options.scope) _scopes.push(...options.scope);\n\t\t\tif (scopes) _scopes.push(...scopes);\n\t\t\treturn await createAuthorizationURL({\n\t\t\t\tid: \"linkedin\",\n\t\t\t\toptions,\n\t\t\t\tauthorizationEndpoint,\n\t\t\t\tscopes: _scopes,\n\t\t\t\tstate,\n\t\t\t\tloginHint,\n\t\t\t\tredirectURI,\n\t\t\t});\n\t\t},\n\t\tvalidateAuthorizationCode: async ({ code, redirectURI }) => {\n\t\t\treturn await validateAuthorizationCode({\n\t\t\t\tcode,\n\t\t\t\tredirectURI,\n\t\t\t\toptions,\n\t\t\t\ttokenEndpoint,\n\t\t\t});\n\t\t},\n\t\trefreshAccessToken: options.refreshAccessToken\n\t\t\t? options.refreshAccessToken\n\t\t\t: async (refreshToken) => {\n\t\t\t\t\treturn refreshAccessToken({\n\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tclientId: options.clientId,\n\t\t\t\t\t\t\tclientKey: options.clientKey,\n\t\t\t\t\t\t\tclientSecret: options.clientSecret,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttokenEndpoint,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\tasync getUserInfo(token) {\n\t\t\tif (options.getUserInfo) {\n\t\t\t\treturn options.getUserInfo(token);\n\t\t\t}\n\t\t\tconst { data: profile, error } = await betterFetch<LinkedInProfile>(\n\t\t\t\t\"https://api.linkedin.com/v2/userinfo\",\n\t\t\t\t{\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\tAuthorization: `Bearer ${token.accessToken}`,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tif (error) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst userMap = await options.mapProfileToUser?.(profile);\n\t\t\treturn {\n\t\t\t\tuser: {\n\t\t\t\t\tid: profile.sub,\n\t\t\t\t\tname: profile.name,\n\t\t\t\t\temail: profile.email,\n\t\t\t\t\temailVerified: profile.email_verified || false,\n\t\t\t\t\timage: profile.picture,\n\t\t\t\t\t...userMap,\n\t\t\t\t},\n\t\t\t\tdata: profile,\n\t\t\t};\n\t\t},\n\t\toptions,\n\t} satisfies OAuthProvider<LinkedInProfile>;\n};\n"],"mappings":";;;;;;;AA0BA,MAAa,YAAY,YAA6B;CACrD,MAAM,wBACL;CACD,MAAM,gBAAgB;AAEtB,QAAO;EACN,IAAI;EACJ,MAAM;EACN,wBAAwB,OAAO,EAC9B,OACA,QACA,aACA,gBACK;GACL,MAAM,UAAU,QAAQ,sBACrB,EAAE,GACF;IAAC;IAAW;IAAS;IAAS;AACjC,OAAI,QAAQ,MAAO,SAAQ,KAAK,GAAG,QAAQ,MAAM;AACjD,OAAI,OAAQ,SAAQ,KAAK,GAAG,OAAO;AACnC,UAAO,MAAM,uBAAuB;IACnC,IAAI;IACJ;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA,CAAC;;EAEH,2BAA2B,OAAO,EAAE,MAAM,kBAAkB;AAC3D,UAAO,MAAM,0BAA0B;IACtC;IACA;IACA;IACA;IACA,CAAC;;EAEH,oBAAoB,QAAQ,qBACzB,QAAQ,qBACR,OAAO,iBAAiB;AACxB,UAAO,mBAAmB;IACzB;IACA,SAAS;KACR,UAAU,QAAQ;KAClB,WAAW,QAAQ;KACnB,cAAc,QAAQ;KACtB;IACD;IACA,CAAC;;EAEL,MAAM,YAAY,OAAO;AACxB,OAAI,QAAQ,YACX,QAAO,QAAQ,YAAY,MAAM;GAElC,MAAM,EAAE,MAAM,SAAS,UAAU,MAAM,YACtC,wCACA;IACC,QAAQ;IACR,SAAS,EACR,eAAe,UAAU,MAAM,eAC/B;IACD,CACD;AAED,OAAI,MACH,QAAO;GAGR,MAAM,UAAU,MAAM,QAAQ,mBAAmB,QAAQ;AACzD,UAAO;IACN,MAAM;KACL,IAAI,QAAQ;KACZ,MAAM,QAAQ;KACd,OAAO,QAAQ;KACf,eAAe,QAAQ,kBAAkB;KACzC,OAAO,QAAQ;KACf,GAAG;KACH;IACD,MAAM;IACN;;EAEF;EACA"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/social-providers/microsoft-entra-id.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* @see [Microsoft Identity Platform - Optional claims reference](https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims-reference)
|
|
7
|
+
*/
|
|
8
|
+
interface MicrosoftEntraIDProfile extends Record<string, any> {
|
|
9
|
+
/** Identifies the intended recipient of the token */
|
|
10
|
+
aud: string;
|
|
11
|
+
/** Identifies the issuer, or "authorization server" that constructs and returns the token */
|
|
12
|
+
iss: string;
|
|
13
|
+
/** Indicates when the authentication for the token occurred */
|
|
14
|
+
iat: Date;
|
|
15
|
+
/** Records the identity provider that authenticated the subject of the token */
|
|
16
|
+
idp: string;
|
|
17
|
+
/** Identifies the time before which the JWT can't be accepted for processing */
|
|
18
|
+
nbf: Date;
|
|
19
|
+
/** Identifies the expiration time on or after which the JWT can't be accepted for processing */
|
|
20
|
+
exp: Date;
|
|
21
|
+
/** Code hash included in ID tokens when issued with an OAuth 2.0 authorization code */
|
|
22
|
+
c_hash: string;
|
|
23
|
+
/** Access token hash included in ID tokens when issued with an OAuth 2.0 access token */
|
|
24
|
+
at_hash: string;
|
|
25
|
+
/** Internal claim used to record data for token reuse */
|
|
26
|
+
aio: string;
|
|
27
|
+
/** The primary username that represents the user */
|
|
28
|
+
preferred_username: string;
|
|
29
|
+
/** User's email address */
|
|
30
|
+
email: string;
|
|
31
|
+
/** Human-readable value that identifies the subject of the token */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Matches the parameter included in the original authorize request */
|
|
34
|
+
nonce: string;
|
|
35
|
+
/** User's profile picture */
|
|
36
|
+
picture: string;
|
|
37
|
+
/** Immutable identifier for the user account */
|
|
38
|
+
oid: string;
|
|
39
|
+
/** Set of roles assigned to the user */
|
|
40
|
+
roles: string[];
|
|
41
|
+
/** Internal claim used to revalidate tokens */
|
|
42
|
+
rh: string;
|
|
43
|
+
/** Subject identifier - unique to application ID */
|
|
44
|
+
sub: string;
|
|
45
|
+
/** Tenant ID the user is signing in to */
|
|
46
|
+
tid: string;
|
|
47
|
+
/** Unique identifier for a session */
|
|
48
|
+
sid: string;
|
|
49
|
+
/** Token identifier claim */
|
|
50
|
+
uti: string;
|
|
51
|
+
/** Indicates if user is in at least one group */
|
|
52
|
+
hasgroups: boolean;
|
|
53
|
+
/** User account status in tenant (0 = member, 1 = guest) */
|
|
54
|
+
acct: 0 | 1;
|
|
55
|
+
/** Auth Context IDs */
|
|
56
|
+
acrs: string;
|
|
57
|
+
/** Time when the user last authenticated */
|
|
58
|
+
auth_time: Date;
|
|
59
|
+
/** User's country/region */
|
|
60
|
+
ctry: string;
|
|
61
|
+
/** IP address of requesting client when inside VNET */
|
|
62
|
+
fwd: string;
|
|
63
|
+
/** Group claims */
|
|
64
|
+
groups: string;
|
|
65
|
+
/** Login hint for SSO */
|
|
66
|
+
login_hint: string;
|
|
67
|
+
/** Resource tenant's country/region */
|
|
68
|
+
tenant_ctry: string;
|
|
69
|
+
/** Region of the resource tenant */
|
|
70
|
+
tenant_region_scope: string;
|
|
71
|
+
/** UserPrincipalName */
|
|
72
|
+
upn: string;
|
|
73
|
+
/** User's verified primary email addresses */
|
|
74
|
+
verified_primary_email: string[];
|
|
75
|
+
/** User's verified secondary email addresses */
|
|
76
|
+
verified_secondary_email: string[];
|
|
77
|
+
/** Whether the user's email is verified (optional claim, must be configured in app registration) */
|
|
78
|
+
email_verified?: boolean | undefined;
|
|
79
|
+
/** VNET specifier information */
|
|
80
|
+
vnet: string;
|
|
81
|
+
/** Client Capabilities */
|
|
82
|
+
xms_cc: string;
|
|
83
|
+
/** Whether user's email domain is verified */
|
|
84
|
+
xms_edov: boolean;
|
|
85
|
+
/** Preferred data location for Multi-Geo tenants */
|
|
86
|
+
xms_pdl: string;
|
|
87
|
+
/** User preferred language */
|
|
88
|
+
xms_pl: string;
|
|
89
|
+
/** Tenant preferred language */
|
|
90
|
+
xms_tpl: string;
|
|
91
|
+
/** Zero-touch Deployment ID */
|
|
92
|
+
ztdid: string;
|
|
93
|
+
/** IP Address */
|
|
94
|
+
ipaddr: string;
|
|
95
|
+
/** On-premises Security Identifier */
|
|
96
|
+
onprem_sid: string;
|
|
97
|
+
/** Password Expiration Time */
|
|
98
|
+
pwd_exp: number;
|
|
99
|
+
/** Change Password URL */
|
|
100
|
+
pwd_url: string;
|
|
101
|
+
/** Inside Corporate Network flag */
|
|
102
|
+
in_corp: string;
|
|
103
|
+
/** User's family name/surname */
|
|
104
|
+
family_name: string;
|
|
105
|
+
/** User's given/first name */
|
|
106
|
+
given_name: string;
|
|
107
|
+
}
|
|
108
|
+
interface MicrosoftOptions extends ProviderOptions<MicrosoftEntraIDProfile> {
|
|
109
|
+
clientId: string;
|
|
110
|
+
/**
|
|
111
|
+
* The tenant ID of the Microsoft account
|
|
112
|
+
* @default "common"
|
|
113
|
+
*/
|
|
114
|
+
tenantId?: string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* The authentication authority URL. Use the default "https://login.microsoftonline.com" for standard Entra ID or "https://<tenant-id>.ciamlogin.com" for CIAM scenarios.
|
|
117
|
+
* @default "https://login.microsoftonline.com"
|
|
118
|
+
*/
|
|
119
|
+
authority?: string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The size of the profile photo
|
|
122
|
+
* @default 48
|
|
123
|
+
*/
|
|
124
|
+
profilePhotoSize?: (48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648) | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Disable profile photo
|
|
127
|
+
*/
|
|
128
|
+
disableProfilePhoto?: boolean | undefined;
|
|
129
|
+
}
|
|
130
|
+
declare const microsoft: (options: MicrosoftOptions) => {
|
|
131
|
+
id: "microsoft";
|
|
132
|
+
name: string;
|
|
133
|
+
createAuthorizationURL(data: {
|
|
134
|
+
state: string;
|
|
135
|
+
codeVerifier: string;
|
|
136
|
+
scopes?: string[] | undefined;
|
|
137
|
+
redirectURI: string;
|
|
138
|
+
display?: string | undefined;
|
|
139
|
+
loginHint?: string | undefined;
|
|
140
|
+
}): Promise<URL>;
|
|
141
|
+
validateAuthorizationCode({
|
|
142
|
+
code,
|
|
143
|
+
codeVerifier,
|
|
144
|
+
redirectURI
|
|
145
|
+
}: {
|
|
146
|
+
code: string;
|
|
147
|
+
redirectURI: string;
|
|
148
|
+
codeVerifier?: string | undefined;
|
|
149
|
+
deviceId?: string | undefined;
|
|
150
|
+
}): Promise<OAuth2Tokens>;
|
|
151
|
+
getUserInfo(token: OAuth2Tokens & {
|
|
152
|
+
user?: {
|
|
153
|
+
name?: {
|
|
154
|
+
firstName?: string;
|
|
155
|
+
lastName?: string;
|
|
156
|
+
};
|
|
157
|
+
email?: string;
|
|
158
|
+
} | undefined;
|
|
159
|
+
}): Promise<{
|
|
160
|
+
user: {
|
|
161
|
+
id: string;
|
|
162
|
+
name?: string;
|
|
163
|
+
email?: string | null;
|
|
164
|
+
image?: string;
|
|
165
|
+
emailVerified: boolean;
|
|
166
|
+
[key: string]: any;
|
|
167
|
+
};
|
|
168
|
+
data: any;
|
|
169
|
+
} | null>;
|
|
170
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
171
|
+
options: MicrosoftOptions;
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
export { MicrosoftEntraIDProfile, MicrosoftOptions, microsoft };
|
|
175
|
+
//# sourceMappingURL=microsoft-entra-id.d.mts.map
|