Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sample-01/api-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const appOrigin = authConfig.appOrigin || `http://localhost:${appPort}`;
if (
!authConfig.domain ||
!authConfig.audience ||
authConfig.audience === "YOUR_API_IDENTIFIER"
["{yourApiIdentifier}", "{API_IDENTIFIER}"].includes(authConfig.audience)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can "{API_IDENTIFIER}" be passed as a default value? I am just wondering where this is coming from as "{yourApiIdentifier}" seems to be the default value.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked at some python sample apps and saw that they have "{API_IDENTIFIER}" as the default value for API_IDENTIFIER. Please disregard the above comment.

) {
console.log(
"Exiting: Please make sure that auth_config.json is in place and populated with valid domain and audience values"
Expand Down
2 changes: 1 addition & 1 deletion Sample-01/src/__tests__/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("The config module", () => {
});

it("should omit the audience if left at a default value", () => {
mockConfig({ audience: "YOUR_API_IDENTIFIER" });
mockConfig({ audience: "{yourApiIdentifier}" });

const { getConfig } = require("../config");

Expand Down
4 changes: 2 additions & 2 deletions Sample-01/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import configJson from "./auth_config.json";

export function getConfig() {
// Configure the audience here. By default, it will take whatever is in the config
// (specified by the `audience` key) unless it's the default value of "YOUR_API_IDENTIFIER" (which
// (specified by the `audience` key) unless it's the default value of "{yourApiIdentifier}" (which
// is what you get sometimes by using the Auth0 sample download tool from the quickstart page, if you
// don't have an API).
// If this resolves to `null`, the API page changes to show some helpful info about what to do
// with the audience.
const audience =
configJson.audience && configJson.audience !== "YOUR_API_IDENTIFIER"
configJson.audience && configJson.audience !== "{yourApiIdentifier}"
? configJson.audience
: null;

Expand Down
13 changes: 5 additions & 8 deletions Sample-01/src/views/ExternalApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ export const ExternalApiComponent = () => {
error: null,
});

const {
getAccessTokenSilently,
loginWithPopup,
getAccessTokenWithPopup,
} = useAuth0();
const { getAccessTokenSilently, loginWithPopup, getAccessTokenWithPopup } =
useAuth0();

const handleConsent = async () => {
try {
Expand Down Expand Up @@ -130,9 +127,9 @@ export const ExternalApiComponent = () => {
<p>
You can't call the API at the moment because your application does
not have any configuration for <code>audience</code>, or it is
using the default value of <code>YOUR_API_IDENTIFIER</code>. You
might get this default value if you used the "Download Sample"
feature of{" "}
using the default value of{" "}
<code>&#123;yourApiIdentifier&#125;</code>. You might get this
default value if you used the "Download Sample" feature of{" "}
<a href="https://auth0.com/docs/quickstart/spa/react">
the quickstart guide
</a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I had to use the HTML characters for {}, as it was considering the brackets as JSX and causing the tests to fail.

Expand Down