Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access denied when calling getSession inside API route #407

Closed
Jaxenormus opened this issue Jun 1, 2021 · 1 comment
Closed

Access denied when calling getSession inside API route #407

Jaxenormus opened this issue Jun 1, 2021 · 1 comment

Comments

@Jaxenormus
Copy link

Description

When I call getSession inside of my API it throws an error showing that it attempted to make an API call to oauth/token and it was hit with a 401 but my API handler is wrapped in withApiAuthRequired which does not fail and I am authenticated so I'm stumped why calling getSession is failing.

Reproduction

  1. Follow the setup setups outlined in the README of this package
  2. Create an API route as shown below
import { getSession, withApiAuthRequired } from "@auth0/nextjs-auth0"
import { NextApiRequest, NextApiResponse } from "next"

const handler = async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
  const data = getSession(req, res)
  // Ommitted the rest of the code as not applicable
}

export default withApiAuthRequired(handler)
  1. Call this API when you are authenticated inside of your application and it will throw the error

Environment

Please provide the following:

  • Version of this library used: 1.3.1
  • Version of the platform or framework used, if applicable: 10.2.0
@Jaxenormus
Copy link
Author

Jaxenormus commented Jun 1, 2021

It looks like it was an issue on my end deleting all my applications in Auth0 seemed to fix it

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

No branches or pull requests

1 participant