Stuggling with "Unable to issue redirect for OAuth 2.0 transaction"

Hello everyone,

Struggling to get past the error mentioned in the topic… I have gone through various similar posts for this error and understand the issue is usually a typo. However, I have tried to copy-paste from the docs as much as possible explicitly. That being said, I cannot identify what is wrong with my code! I would appreciate any guidance and am willing to share any other info needed. I really appreciate any help you can provide.

Apologies in advance. I did not understand which tags fit this situation!

This is the error log:

{
  "date": "2023-02-10T22:55:48.384Z",
  "type": "f",
  "description": "Unable to issue redirect for OAuth 2.0 transaction",
  "connection": "github-users-db",
  "connection_id": "con_M0Iq03c8kVDZQeMm",
  "client_id": "dF0awL5MjYges1UFPRBj7Qs1Mt4W0LKL",
  "client_name": "Github Users",
  "ip": "2603:8080:7300:97a:9481:e844:c78c:ccd9",
  "user_agent": "Chrome 109.0.0 / Windows 10.0.0",
  "details": {
    "body": {},
    "qs": {
      "state": "eJwcEpB_1uKG0irzcsPDPQP-XaANXfCp"
    },
    "connection": "github-users-db",
    "error": {
      "message": "Unable to issue redirect for OAuth 2.0 transaction",
      "oauthError": "server_error",
      "type": "oauth-authorization"
    },
    "session_id": "2-iS9_z0C-2CTxgHOqD6MfIKlJhY-eqh"
  },
  "hostname": "dev-yhy2r863cr3afldj.us.auth0.com",
  "user_id": "auth0|63e5341674eb8928e0b4327c",
  "user_name": "adamdenais@gmail.com",
  "strategy": "auth0",
  "strategy_type": "database",
  "audience": "https://dev-yhy2r863cr3afldj.us.auth0.com/userinfo",
  "scope": [
    "openid",
    "profile",
    "email"
  ],
  "log_id": "90020230210225549617889504823857192080197423698976702482",
  "_id": "90020230210225549617889504823857192080197423698976702482",
  "isMobile": false,
  "id": "90020230210225549617889504823857192080197423698976702482"
}

This is my index.js code:

import { Auth0Provider } from "@auth0/auth0-react";


const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <Auth0Provider
      domain="dev-yhy2r863cr3afldj.us.auth0.com"
      clientId="dF0awL5MjYges1UFPRBj7Qs1Mt4W0LKL"
      authorizationParams={{
        redirect_uri: window.location.origin
      }}
    >
      <GithubProvider>
        <App />
      </GithubProvider>
    </Auth0Provider>
  </React.StrictMode>
);

This is my related login code in my Navbar component:

import { useAuth0 } from "@auth0/auth0-react";

const Navbar = () => {
  const { loginWithRedirect } =
    useAuth0();

  return (
        <button onClick={() => loginWithRedirect()}>Login</button>
  );
};

Hi there @adamdenais welcome to the community!

  • Have you made sure that the redirect_uri is added as an allowed callback in the app settings in your Auth0 dashboard?

  • If you inspect the network tab as you attempt the login flow, does the redirect_uri param of the call to /authorize look correct?

I would start here for sure :slight_smile: It might also be worth taking a step back and keying our react sample app to your environment in order to test/compare against.

Keep us posted!

1 Like

I appreciate the thoughtful response!
Any other thoughts based on this:

  • In my allowed callback in the app settings I simply have: http://localhost:3000

  • After inspecting the network tab I see that their is a 500 error that starts with “authorize?authorizationParams=…”

Still pretty new to coding but trying my best! I’ll check out the sample app tomorrow and dive through it.

I did some more exploring today and still having issues unfortunately.

I downloaded the sample app keyed to the “Default App” and after clicking the login button I get:

“Oops… Service not found: {yourApiIdentifier}”

Is something may be wrong with my Auth0 settings?

I don’t claim to know what the issue was but I solved my problem.

I changed
authorizationParams={{ redirect_uri: window.location.origin }}
to
redirectUri={window.location.origin}
and it worked.

1 Like

Hi there @adamdenais!

Sorry for the delayed response, but happy to hear you were able to get this sorted! Out of curiosity and for the benefit of future community members, which version of auth0-react are you using? There are some differences to how authorize params are handled between v1v2.

Cheers!

I was on Auth0 v1.

I thought I ran an update to Auth0 v2 within my terminal but I guess not.

1 Like

Gotcha, thanks for confirming! That makes sense then as authorizationParams was introduced in v2:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.