-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bungie Provider and Typescript / Does this provider even work? #6930
Comments
Follow up question, does this provider even work? Upon further investigation my short answer is no. Something is wrong deeper into the NextAuth logic then I can follow or configure. I've written a custom OAuth provider that gets through the token retrieval and then afterwards NextAuth tanks and I have no clue as to why. The same issue happens when using the default Bungie provider.
|
I have it working with v3.29.10, but have not got it working with v4 |
Ah good so I'm not crazy it just doesn't work. I'll see about bumping my version down for the project I'm working on. |
I plan to put this in a PR at some point when I have some down time, but I managed to get it working in v4 with some additional config: BungieProvider({
clientId: process.env.BUNGIE_CLIENT_ID,
clientSecret: process.env.BUNGIE_CLIENT_SECRET,
// The Bungie API doesn't like scope being set
authorization: { params: { scope: '' } },
httpOptions: { headers: { 'X-API-Key': process.env.BUNGIE_API_KEY } },
// Correctly gets the current user info so that the existing `profile` definition works
userinfo: {
async request({ tokens, provider }) {
return await fetch(
'https://www.bungie.net/platform/User/GetMembershipsForCurrentUser',
{
headers: {
...provider.httpOptions.headers,
authorization: `Bearer ${tokens.access_token}`
}
}
).then(async response => await response.json())
}
}
}) |
Awesome, I'll give that a try maybe this week. I am not familiar with this library but a better error message would have been very helpful too. It would be nice if the error said something along the lines of "Error loading user info from provider Bungie". |
Hey all, also using the BungieProvider with a new T3 application with the exact same setup as above. I'm running into the following issue:
I check my browser's cookies and it seems that the state cookie is defined. Any idea what could be causing the issue? |
This is working for me:
Index page:
|
Nope, I still get the same error. FWIW, here is part of my "dependencies": {
"@next-auth/prisma-adapter": "^1.0.5",
"@prisma/client": "^4.9.0",
"@tanstack/react-query": "^4.20.2",
"@trpc/client": "^10.9.0",
"@trpc/next": "^10.9.0",
"@trpc/react-query": "^10.9.0",
"@trpc/server": "^10.9.0",
"next": "^13.2.1",
"next-auth": "^4.19.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"superjson": "1.9.1",
"zod": "^3.20.6"
},
"devDependencies": {
"@types/eslint": "^8.21.1",
"@types/node": "^18.14.0",
"@types/prettier": "^2.7.2",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"autoprefixer": "^10.4.7",
"eslint": "^8.34.0",
"eslint-config-next": "^13.2.1",
"postcss": "^8.4.14",
"prettier": "^2.8.1",
"prettier-plugin-tailwindcss": "^0.2.1",
"prisma": "^4.9.0",
"tailwindcss": "^3.2.0",
"typescript": "^4.9.5"
},
"ct3aMetadata": {
"initVersion": "7.7.0"
} |
Question for you, when you click sign in and get redirected to the Bungie screen do you see
|
Yes, I do, I think the URL is well-formed as per the docs. Seems like we're on the same versions for almost all of our dependencies. |
Here is my complete auth setup: .env:
|
Alright, found my bug. My |
I'm personally really surprised Bungie requires localhost to be secure which causes us to need to setup a cert and changing defaults. I'm so used to platforms letting localhost be open because it's used for development |
Question 💬
I followed the example for adding the Bungie provider here. After doing so I found that the default implementation isn't happy with Typescript.
Argument of type '{ clientId: string; clientSecret: string; headers: { "X-API-Key": string; }; }' is not assignable to parameter of type 'Partial<OAuthConfig<any>>'. Object literal may only specify known properties, and 'headers' does not exist in type 'Partial<OAuthConfig<any>>'.
What is the intended setup when using Typescript with this provider?
How to reproduce ☕️
create t3 app
Contributing 🙌🏽
No, I am afraid I cannot help regarding this.
Unless it is as simple as changing the default to this:
The text was updated successfully, but these errors were encountered: