Skip to content

Changing duplicate {yourApiIdentifier} value when downloaded as sample app from Quickstarts #385

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

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

mchang16-auth
Copy link
Contributor

@mchang16-auth mchang16-auth commented Mar 19, 2025

Background

Currently, this line in api-server.js is:

 ['{yourApiIdentifier}', '{API_IDENTIFIER}'].includes(
    authConfig.authorizationParams.audience
  )

But when the React sample app is downloaded from the Quickstarts (both Dashboard and from auth0.com/docs) and the user does not have an API created, this line in api-server.js becomes:

['{yourApiIdentifier}', '{yourApiIdentifier}'].includes(
    authConfig.authorizationParams.audience

This is because '{API_IDENTIFIER}' is being replaced with '{yourApiIdentifier}' when downloaded as a sample app.
Note: this was happening even prior to the changes made in #382, so that PR did not create this text replacing.

Changes

In this PR, we changed ['{yourApiIdentifier}', '{API_IDENTIFIER}'] to authConfig.authorizationParams.audience === '{API_IDENTIFIER}' to remove this duplicated string from happening. This way, it still satisfies both use cases:

  • '{API_IDENTIFIER}' is used when a user downloads the sample app straight from Github
  • '{yourApiIdentifier}' is used when a user downloads the sample app from a Quickstart

@mchang16-auth mchang16-auth changed the title Changing duplicate {yourApiIdentifier} value when downloaded as sample app Changing duplicate {yourApiIdentifier} value when downloaded as sample app from Quickstarts Mar 19, 2025
@mchang16-auth mchang16-auth marked this pull request as ready for review March 19, 2025 16:20
@mchang16-auth mchang16-auth merged commit 428e51c into auth0-samples:master Mar 20, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants