Difficulty implementing custom provider (Yahoo!) #769
-
Apologies in advance as I'm still learning about authentication! I'm having difficulty trying to create a session for Yahoo's fantasy sports API. I was able to reach part of step 3 when a user is prompted with the request access screen. However once the user clicks accept, the website hangs and results in a 504. What's interesting is that the URL on the 504 error screen includes the Here's my Is there something I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
Hey, any chance you can share the code for the custom provider options for Yahoo? I'm also trying to interact with the Yahoo sports api. |
Beta Was this translation helpful? Give feedback.
-
I don't remember exactly what I had written but I think it looked similar to this: // [...nextauth].ts
export const authOptions: any = {
providers: [
{
id: 'yahoo',
name: 'Yahoo',
type: 'oauth',
clientId: YAHOO_CLIENT_ID,
authorization: {
url: 'https://api.login.yahoo.com/oauth2/request_auth',
params: {
client_id: YAHOO_CLIENT_ID,
redirect_uri: NEXTAUTH_URL,
response_type: 'code',
},
},
},
],
callbacks: {
async signIn({ user, account, profile, email, credentials }: any) {
return true;
},
async redirect({ url, baseUrl }: any) {
return baseUrl;
},
async session({ session, user, token }: any) {
return session;
},
async jwt({ token, user, account, profile, isNewUser }: any) {
return token;
},
},
};
export default NextAuth(authOptions); Revisiting this now, I'm able to authorize successfully and get redirect to the This person found a workaround though. The only potential issue I see with that workaround is how to set the session state within |
Beta Was this translation helpful? Give feedback.
-
Finally after 4 hours of documentation and squeezing each an every bit of Chat GPT and Gemini I finally got Yahoo OAuth 2.0 i used, ngork to crate a tunnel from localhost:3000 -> https://b62d-2405-201-a00a-a0cf-7d7b-1ec5-b269-f8fc.ngrok-free.app to get a https which can be used as a callback and Homepage URL in Yahoo OAuth 2.0 app creation. //api//auth//[...nextauth]/route.ts const handler = NextAuth(authOptions) Documentation followed - https://developer.yahoo.com/oauth2/guide/flows_authcode/ ![]() By Using this, i was able to login using Yahoo OAuth 2.0 in My Next-Auth Authentication. |
Beta Was this translation helpful? Give feedback.
Yup, I've finally figured it out. Turns out Yahoo has their own
well-known
which solves everything.Here's my updated
[...nextauth].ts