Skip to content

Instantly share code, notes, and snippets.

@allpwrfulroot
Last active December 18, 2019 02:40
Show Gist options
  • Save allpwrfulroot/869ec203bb751450b2756c551db53a09 to your computer and use it in GitHub Desktop.
Save allpwrfulroot/869ec203bb751450b2756c551db53a09 to your computer and use it in GitHub Desktop.
API route to get user information from an HttpOnly cookie
// From the docs: https://github.com/auth0/nextjs-auth0#user-profile
import auth0 from 'contexts/auth0'
export default async function me(req, res) {
try {
await auth0.handleProfile(req, res)
} catch (error) {
console.error(error)
res.status(error.status || 500).end(error.message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment