You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, Trying to bake together a custom provider to handle Xbox Live sign in for users.
I initially created a route handler under /api/auth/azure-id/callback/route.ts to handle it all and realised it was incorrect, but the returns of all the API Calls for tokens etc were fine.
I went to bake the logic into the provider, as from outside the NextAuth area its unable to set the user / create a user / session etc.
The initial Auth screen comes up, requests access etc, but the callback URL bricks with a HTTP GET is not supported by NextAuth.
The return from the authorization call returns a GET request which is not being respected by NextAuth for some reason, is it because 'azure-id' (a custom provider, not AD, confusing i know) is not being read by nextauth as a needed callback url?
None of the functions get called as it bricks the callback url.
// src/nextauth-xbox/index.jsimport{randomUUID}from"crypto";import{OAuthUserConfig}from"next-auth/providers/oauth";import{PROVIDER_ID,PROVIDER_NAME}from"./constants";exportinterfaceXboxProfileextendsRecord<string,any>{}exportinterfaceXboxProviderOptionsextendsPartial<OAuthUserConfig<XboxProfile>>{clientSecret: string;}exportfunctionXbox(options: XboxProviderOptions): OAuthUserConfig<XboxProfile>{return{options: optionsasOAuthUserConfig<XboxProfile>,id: PROVIDER_ID,name: PROVIDER_NAME,type: "oauth",clientId: "",authorization: {url: `https://login.live.com/oauth20_authorize.srf`,params: {response_type: "code",scope: "Xboxlive.signin Xboxlive.offline_access",redirect_uri: "http://localhost:3000/api/auth/azure-id/callback",},},token: {url: "http://localhost:3000/api/auth/azure-id/callback",asyncrequest(context){// context contains useful properties to help you make the request.console.log({ context });// return { tokens };},},asyncauthorize(credentials,req){console.log({ credentials, req });},userinfo: {asyncrequest(){console.log("userinfo called");return{id: "",image: "",email: "",name: "",};},},asyncprofile(){console.log("Profile was called...");return{id: "",name: "",email: "",image: "",};},};}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all, Trying to bake together a custom provider to handle Xbox Live sign in for users.
I initially created a route handler under /api/auth/azure-id/callback/route.ts to handle it all and realised it was incorrect, but the returns of all the API Calls for tokens etc were fine.
I went to bake the logic into the provider, as from outside the NextAuth area its unable to set the user / create a user / session etc.
The initial Auth screen comes up, requests access etc, but the callback URL bricks with a HTTP GET is not supported by NextAuth.
The return from the authorization call returns a GET request which is not being respected by NextAuth for some reason, is it because 'azure-id' (a custom provider, not AD, confusing i know) is not being read by nextauth as a needed callback url?
None of the functions get called as it bricks the callback url.
Any help would be greatly appreciated, at least getting over the GET request issue hurdle :)
Beta Was this translation helpful? Give feedback.
All reactions