Skip to content

Instantly share code, notes, and snippets.

@sir-dunxalot
Created May 26, 2020 02:23
Show Gist options
  • Save sir-dunxalot/af09c9e454db04db514cd7c1f8b19011 to your computer and use it in GitHub Desktop.
Save sir-dunxalot/af09c9e454db04db514cd7c1f8b19011 to your computer and use it in GitHub Desktop.
cypress-nextjs-auth0__route
import { initAuth0 } from '@auth0/nextjs-auth0';
const auth0Config = { /*...*/ };
const auth0 = initAuth0(auth0Config);
const route = async function me(req, res) {
try {
await auth0.handleProfile(req, res, {});
} catch (error) {
console.error(error);
res.status(error.status || 500).end(error.message);
}
};
export default auth0.requireAuthentication(route);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment