What I am trying to achieve:
- Have existing NextJS v14 app that uses Auth0
- Set up cron job via Azure Function that consumes protected endpoint in NextJS app
What I have done so far:
- Have NextJS app running and protected via auth0
- Created machine-to-machine (m2m) application
- Tried to consume NextJS endpoint using access token generated by m2m app
I am unable to successfully access the endpoint. The NextJS withApiAuthRequired
middleware returns 401
error “The user does not have an active session or is not authenticated”.
What am I missing?