This example code seems like Auth0 should provide a util function since we have to look for specific query parameters whose names are set by Auth0 response. Or at least some constants. Could they ever change, it would break all code using this.
// NEW - check for the code and state parameters
const query = window.location.search;
if (query.includes(“code=”) && query.includes(“state=”)) {
// Process the login state
await auth0.handleRedirectCallback();