Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix (#1212)

bautistaaac8ef9e76eab5
diff --git a/package.json b/package.json
index f548d7c6..7d2e908b 100644
--- a/package.json
+++ b/package.json
@@ -36,8 +36,8 @@
"picocolors": "^1.0.0",
"prettier": "^3.0.2",
"prettier-plugin-tailwindcss": "^0.4.1",
- "turbo": "^1.10.16",
"tsx": "^3.14.0",
+ "turbo": "^1.10.16",
"type-testing": "0.2.0",
"typescript": "^5.1.6",
"vitest": "^0.34.6"
@@ -50,10 +50,10 @@
]
},
"patchedDependencies": {
"@monaco-editor/[email protected]": "patches/@[email protected]",
- "@vercel/[email protected]": "patches/@[email protected]"
+ "@vercel/[email protected]": "patches/@[email protected]",
}
}
}
diff --git a/patches/@[email protected] b/patches/@[email protected]
new file mode 100644
index 00000000..030b3f87
--- /dev/null
+++ b/patches/@[email protected]
@@ -0,0 +1,114 @@
+diff --git a/providers/github.js b/providers/github.js
+index 4b28537419b55d799bbda68cea5936d8033520ef..aa511c6ee018e37a5ed880160da53447c197c5ab 100644
+--- a/providers/github.js
++++ b/providers/github.js
+@@ -60,57 +60,57 @@
+ * :::
+ */
+ export default function GitHub(config) {
+- return {
+- id: "github",
+- name: "GitHub",
+- type: "oauth",
+- authorization: {
+- url: "https://github.com/login/oauth/authorize",
+- params: { scope: "read:user user:email" },
+- },
+- token: "https://github.com/login/oauth/access_token",
+- userinfo: {
+- url: "https://api.github.com/user",
+- async request({ tokens, provider }) {
+- const profile = await fetch(provider.userinfo?.url, {
+- headers: {
+- Authorization: `Bearer ${tokens.access_token}`,
+- "User-Agent": "authjs",
+- },
+- }).then(async (res) => await res.json());
+- if (!profile.email) {
+- // If the user does not have a public email, get another via the GitHub API
+- // See https://docs.github.com/en/rest/users/emails#list-public-email-addresses-for-the-authenticated-user
+- const res = await fetch("https://api.github.com/user/emails", {
+- headers: {
+- Authorization: `Bearer ${tokens.access_token}`,
+- "User-Agent": "authjs",
+- },
+- });
+- if (res.ok) {
+- const emails = await res.json();
+- profile.email = (emails.find((e) => e.primary) ?? emails[0]).email;
+- }
+- }
+- return profile;
++ return {
++ id: "github",
++ name: "GitHub",
++ type: "oauth",
++ authorization: {
++ url: "https://github.com/login/oauth/authorize",
++ params: { scope: "read:user user:email" },
++ },
++ token: "https://github.com/login/oauth/access_token",
++ userinfo: {
++ url: "https://api.github.com/user",
++ async request({ tokens, provider }) {
++ const profile = await fetch(provider.userinfo?.url, {
++ headers: {
++ Authorization: `Bearer ${tokens.access_token}`,
++ "User-Agent": "authjs",
++ },
++ }).then(async (res) => await res.json());
++ if (!profile.email) {
++ // If the user does not have a public email, get another via the GitHub API
++ // See https://docs.github.com/en/rest/users/emails#list-public-email-addresses-for-the-authenticated-user
++ const res = await fetch("https://api.github.com/user/emails", {
++ headers: {
++ Authorization: `Bearer ${tokens.access_token}`,
++ "User-Agent": "authjs",
+ },
+- },
+- profile(profile) {
+- return {
+- id: profile.id.toString(),
+- name: profile.name ?? profile.login,
+- email: profile.email,
+- image: profile.avatar_url,
+- };
+- },
+- style: {
+- logo: "/github.svg",
+- logoDark: "/github-dark.svg",
+- bg: "#fff",
+- bgDark: "#24292f",
+- text: "#000",
+- textDark: "#fff",
+- },
+- options: config,
+- };
++ });
++ if (res.ok) {
++ const emails = await res.json();
++ profile.email = (emails.find((e) => e.primary) ?? emails[0]).email;
++ }
++ }
++ return profile;
++ },
++ },
++ profile(profile) {
++ return {
++ id: profile.id.toString(),
++ name: profile.login,
++ email: profile.email,
++ image: profile.avatar_url,
++ };
++ },
++ style: {
++ logo: "/github.svg",
++ logoDark: "/github-dark.svg",
++ bg: "#fff",
++ bgDark: "#24292f",
++ text: "#000",
++ textDark: "#fff",
++ },
++ options: config,
++ };
+ }
\ No newline at end of file
diff --git a/patches/[email protected] b/patches/[email protected]
deleted file mode 100644
index 0d875f14..00000000
--- a/patches/[email protected]
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/providers/github.js b/providers/github.js
-index d9a68e0f126df7b05fb4b38fa2969827765c43c6..c5c1af28e1773561ea018a4d4720b7e55c632066 100644
---- a/providers/github.js
-+++ b/providers/github.js
-@@ -47,11 +47,9 @@ function Github(options) {
- },
-
- profile(profile) {
-- var _profile$name;
--
- return {
- id: profile.id.toString(),
-- name: (_profile$name = profile.name) !== null && _profile$name !== void 0 ? _profile$name : profile.login,
-+ name: profile.login,
- email: profile.email,
- image: profile.avatar_url
- };
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 13639e8d..2c92652c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -5,6 +5,9 @@ settings:
excludeLinksFromLockfile: false
patchedDependencies:
+ hash: ryv2agbjdbjrmhkqum2c27cxhe
+ path: patches/@[email protected]
'@monaco-editor/[email protected]':
hash: xep4qb27qzc6gvlhv2fxe3r2ka
path: patches/@[email protected]
@@ -14,9 +17,6 @@ patchedDependencies:
hash: j3oqxjoadtct3pc6tokddngzsm
path: patches/[email protected]
- hash: mr6pbhgbmy4dt4xo4hxm5k4ym4
- path: patches/[email protected]
importers:
@@ -96,7 +96,7 @@ importers:
next-auth:
specifier: ^4.22.1
- version: 4.22.1(patch_hash=mr6pbhgbmy4dt4xo4hxm5k4ym4)([email protected])([email protected])([email protected])
next-themes:
specifier: ^0.2.1
@@ -730,7 +730,7 @@ importers:
dependencies:
'@next/eslint-plugin-next':
specifier: canary
- version: 14.0.4-canary.6
+ version: 13.4.20-canary.0
'@repo/tsconfig':
specifier: workspace:*
version: link:../config-typescript
@@ -742,7 +742,7 @@ importers:
'@vercel/style-guide':
specifier: ^4.0.2
eslint:
specifier: ^8.45.0
version: 8.45.0
@@ -822,7 +822,7 @@ packages:
'@jridgewell/trace-mapping': 0.3.18
dev: false
+ /@auth/[email protected](patch_hash=ryv2agbjdbjrmhkqum2c27cxhe):
resolution: {integrity: sha512-/hVzGuFw7nAZimliD8kpuKnNjvkRu+jpaVhYB/FaIXLNJFNwhbO2MgXBnr5tvLIHgRJnR5C9UN5RNpQXiFHuSA==}
peerDependencies:
nodemailer: ^6.8.0
@@ -837,6 +837,7 @@ packages:
preact: 10.11.3
preact-render-to-string: 5.2.3([email protected])
dev: false
+ patched: true
resolution: {integrity: sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==}
@@ -2346,8 +2347,8 @@ packages:
glob: 7.1.7
dev: true
- resolution: {integrity: sha512-iHzfPUU5rcTwDIqMTf8GvSlSmqeuIPPa0zgmWJgwdPV2V9WupehiOGelhpO2j2l0qUM2FVB4VyW8BdV40ixe8g==}
+ resolution: {integrity: sha512-vFC1meiw/awh2xJZMWaoECsfZbgkt2fF3HIg8f2fSM/w41Z86L1SS7SjKmpbbD87yq3tiqgqHmFv0JCych4g4g==}
dependencies:
glob: 7.1.7
dev: false
@@ -5062,7 +5063,7 @@ packages:
yoga-wasm-web: 0.3.0
dev: false
resolution: {integrity: sha512-FroL+oOePzhw7n/I+f7zr4WNroGHT/+2TlW6WH9+CVSjMNsEyu7Qstj2mI5gWIBjT1Y2ZImKPppCzI2cIYmNZw==}
engines: {node: '>=16'}
peerDependencies:
@@ -5082,7 +5083,7 @@ packages:
dependencies:
'@babel/core': 7.22.10
'@babel/eslint-parser': 7.22.10(@babel/[email protected])([email protected])
- '@next/eslint-plugin-next': 14.0.4-canary.6
+ '@next/eslint-plugin-next': 13.4.20-canary.0
'@rushstack/eslint-patch': 1.3.2
'@typescript-eslint/eslint-plugin': 5.59.1(@typescript-eslint/[email protected])([email protected])([email protected])
'@typescript-eslint/parser': 5.62.0([email protected])([email protected])
@@ -9616,7 +9617,7 @@ packages:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
- /[email protected](patch_hash=mr6pbhgbmy4dt4xo4hxm5k4ym4)([email protected])([email protected])([email protected]):
resolution: {integrity: sha512-NTR3f6W7/AWXKw8GSsgSyQcDW6jkslZLH8AiZa5PQ09w1kR8uHtR9rez/E9gAq/o17+p0JYHE8QjF3RoniiObA==}
peerDependencies:
next: ^12.2.5 || ^13
@@ -9640,7 +9641,6 @@ packages:
react-dom: 18.2.0([email protected])
uuid: 8.3.2
dev: false
- patched: true
resolution: {integrity: sha512-WOKhATBFGeONV+29HzFmspNmL7NXxrsCWLfaDKmAd/4DD1nqXE0BzNFH8t3SJBx7PUDMnB6F7xB76LM/AaV1MQ==}
@@ -9652,7 +9652,7 @@ packages:
nodemailer:
optional: true
dependencies:
- '@auth/core': 0.0.0-manual.e9863699
+ '@auth/core': 0.0.0-manual.e9863699(patch_hash=ryv2agbjdbjrmhkqum2c27cxhe)
react: 18.2.0
dev: false