supabase / auth

A JWT based API for managing users and issuing JWT tokens

Home Page:https://supabase.com/docs/guides/auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using oauth with provider linkedin_oidc - Error getting user profile from external provider

omerhochman opened this issue · comments

Version

@nuxtjs/supabase: tried both v1.2.0 and v0.3.8
nuxt: v3.6.5

When using signInWithOAuth with linkedin_oidc

const client = useSupabaseClient()
const result = await client.auth.signInWithOAuth({
    provider: 'linkedin_oidc',
    options: {
        redirectTo: '...'
    }
})

It redirects back to the redirectTo URL with the following query params:
error=server_error&error_code=500&error_description=Error+getting+user+profile+from+external+provider#error=server_error&error_code=500&error_description=Error+getting+user+profile+from+external+provider

When checking the Auth logs in the Supabase platform I found this error:
error: oidc: id token issued by a different provider, expected \"https://www.linkedin.com\" got \"https://www.linkedin.com/oauth\"","level":"error","method":"GET","msg":"500: Error getting user profile from external provider

Thanks for reporting this! afaik we haven't changed anything w.r.t the provider. Checking if anything changed upstream

@omerhochman @GaryAustin1 something definitely changed on linkedin's end :( even their documentation is inconsistent - the discovery document shows the issuer with the /oauth prefix but the docs has the issuer without it...

Looks like the issue is fixed, signInWithOAuth with linkedin_oidc works again!

I am still seeing the oidc: id token issued by a different provider. Is this potentially not fully rolled out?

@omerhochman Do I need to update the version? because I am still getting this error.

Hey @jagatfx and @ahmedivy, I don't know why it fails for you, I did not change anything. They probably fixed an endpoint up here.

I am actually using an old version of @nuxtjs/supabase as a module in my nuxt.config.js

This is from my package.json

    "@nuxtjs/supabase": "^0.3.8",

And this is the usage:

const result = await authClient.auth.signInWithOAuth({
    provider: 'linkedin_oidc',
    options: {
      redirectTo: `${WEBAPP_URL}/onboarding`,
    },
  })

Works for me.

@omerhochman I am using with Nextjs

"@supabase/ssr": "^0.3.0",
"@supabase/supabase-js": "^2.42.4",
export const linkedInSignIn = async () => {
  const supabase = createClient();
  const origin = headers().get("origin");

  const { data, error } = await supabase.auth.signInWithOAuth({
    provider: "linkedin_oidc",
    options: {
      redirectTo: `${origin}/auth/callback`,
    },
  });

  if (error) {
    return redirect("/login?message=Could not authenticate user");
  }

  redirect(data.url);
};

@ahmedivy Were you able to get this issue fixed on your end? I am having the same issue.

Hey @jagatfx and @ahmedivy, I don't know why it fails for you, I did not change anything. They probably fixed an endpoint up here.

I am actually using an old version of @nuxtjs/supabase as a module in my nuxt.config.js

This is from my package.json

    "@nuxtjs/supabase": "^0.3.8",

And this is the usage:

const result = await authClient.auth.signInWithOAuth({
    provider: 'linkedin_oidc',
    options: {
      redirectTo: `${WEBAPP_URL}/onboarding`,
    },
  })

Works for me.

Thanks. I had to write into support and have them change a piece of my infrastructure setup. My GoTrue version was stuck at 2.148.0 but the fix is in 2.149.0. The settings are at https://supabase.com/dashboard/project/_/settings/infrastructure.

Screenshot 2024-04-18 at 11 01 38 AM