Skip to content
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

Wrong audience for Auth0 #43

Open
peter-volkov opened this issue Nov 2, 2023 · 4 comments
Open

Wrong audience for Auth0 #43

peter-volkov opened this issue Nov 2, 2023 · 4 comments
Assignees

Comments

@peter-volkov
Copy link

audience: `http://127.0.0.1:3030`, // replace with your API identifier

@matthewtanner91
Shouldn't it be changed to something like process.env.REACT_APP_AUTH0_API_AUDIENCE
?

Because otherwise Auth0 with return "{ error: "access_denied", errorDescription: "Service not found: http://127.0.0.1:3030", state: "0pxyoUsOXEdEf6MMfy4eZwKgefhfc2Iw" }

@matthewtanner91
Copy link
Contributor

@peter-volkov this is because you’ll have to add the API in Auth0. I believe this is documented in the readme but let me check. You may see a quick PR pop up for this when I’m back online describing the steps in the readme or with a slight code change. Stay tuned.

@matthewtanner91 matthewtanner91 self-assigned this Nov 2, 2023
@peter-volkov
Copy link
Author

peter-volkov commented Nov 2, 2023

Yes. The doc says

On the next page that appears, select the Settings tab. In the settings tab, scroll down to the Application URIs section. In this section you’ll need to add http://127.0.0.1:4000, or the URL where your developer portal will be hosted, as an entry for Allowed Callback URLs, Allowed Logout URLs, and Allowed Web Origins.

And I did it. Still get "Service not found" response from Auth0.

I set there management URL ( https://dev-jy6v3fnerbvyxy6p.us.auth0.com/api/v2/ in my case )
as it is recommended in
https://community.auth0.com/t/error-access-denied-errordescription-service-not-found/105583/3
When I set it, it starts the Oauth flow at least.

@srmeier
Copy link

srmeier commented Dec 31, 2023

Faced a similar issue with audience URL in Auth0ProviderWithNavigate.js, setting it to REACT_APP_AUTH0_AUDIENCE addressed the issue.

@xinghengwang
Copy link
Member

xinghengwang commented Nov 21, 2024

yes.

audience: process.env.REACT_APP_DEV_PORTAL_API_SERVER,

The audience needs to be defined in envionrment variable

authorizationParams={{
    redirect_uri: window.location.origin,
    audience: process.env.REACT_APP_DEV_PORTAL_API_SERVER,
    scope: "openid profile email offline_access", // Request offline_access scope
  }}

And in your Auth0 account, you need to create an "application" that correspond to this audience. https://auth0.com/docs/get-started/applications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants