Skip to content

Conversation

@tusharpandey13
Copy link

Migration of sample app to Nexjs SDK v4

# Your Auth0 tenant domain
AUTH0_DOMAIN='YOUR_AUTH0_DOMAIN.auth0.com'
# The base url of your application
APP_BASE_URL='http://localhost:3000'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the order, so we simplify the diff?

Copy link
Contributor

Choose a reason for hiding this comment

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

Order isnt maintained

Copy link
Contributor

@frederikprijck frederikprijck left a comment

Choose a reason for hiding this comment

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

Can we move updating nextjs to v14 or 15 in another PR?

"@babel/preset-typescript"
],
"plugins": []
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this neccessary to update the SDK?

For the **External API** page to work, you will need to [create an API](https://auth0.com/docs/authorization/apis) using the [management dashboard](https://manage.auth0.com/#/apis). This will give you an API Identifier that you can use in the `AUTH0_AUDIENCE` environment variable below. Then you will need to [add a permission](https://auth0.com/docs/get-started/dashboard/add-api-permissions) named `read:shows` to your API.

If you do not wish to use an API or observe the API call working, you should not specify the `AUTH0_AUDIENCE` and `AUTH0_SCOPE` values in the next steps.
If you do not wish to use an API or observe the API call working, you should not specify the `AUTH0_AUDIENCE` value in the next steps.
Copy link
Contributor

Choose a reason for hiding this comment

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

AUTH0_AUDIENCE?

The project needs to be configured with your Auth0 Domain, Client ID and Client Secret for the authentication flow to work.

To do this, first copy `.env.local.example` into a new file in the same folder called `.env.local`, and replace the values with your own Auth0 application credentials (see more info about [loading environmental variables in Next.js](https://nextjs.org/docs/basic-features/environment-variables)):
To do this, first copy `.env.local.example` into a new file in the same folder called `.env.local`, and replace the values with your own Auth0 application credentials:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this link (https://nextjs.org/docs/basic-features/environment-variables) no longer relevant?

import initFontAwesome from '../utils/initFontAwesome';

// Initialize FontAwesome icons
initFontAwesome();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this neccessary for updating our SDK?

Comment on lines +9 to +12
const { isAuthenticated, user, guardComponent } = useAuthGuard();

// If not authenticated or loading, show guard component
if (!isAuthenticated) return guardComponent;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think introducing useAuthGuard here causes unneccesary complications in the diff.

window.location.href = '/auth/login';
}
guardComponent = <Loading />;
}
Copy link
Contributor

@frederikprijck frederikprijck Mar 26, 2025

Choose a reason for hiding this comment

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

I think guardComponent is not the best idea in the sense that it isnt clear what it actually is where used.

If customers want that, they can, but let's refrain from adding this complexity in our sample but stay explicit.

transformIgnorePatterns: [
"/node_modules/(?!highlight\\.js)"
]
}; No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this ?

authorizationParameters: {
scope: "openid profile email offline_access read:shows",
}
}); No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have this ts file, and the js file?

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