Created
May 26, 2020 02:23
-
-
Save sir-dunxalot/af09c9e454db04db514cd7c1f8b19011 to your computer and use it in GitHub Desktop.
cypress-nextjs-auth0__route
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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