You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have implemented withMiddlewareAuthRequired to protect our pages. The returnTo param that is added automatically as redirect when navigating to a protected page directly contains the full URL instead of a relative path to the page.
I expect a relative URL to be set as described in the docs:
"/api/auth/login: Your Next.js application redirects users to your identity provider for them to log in (you can optionally pass a returnTo parameter to return to a custom relative URL after login, for example /api/auth/login?returnTo=/profile)."
We host our app as a container and in that environment it still shows localhost as the domain instead of our custom domain. (ex. "/api/auth/login?returnTo=http://localhost:3000/profile")
Also, these docs could use some updates. This import does not work: import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/middleware';
But this does: import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge';
Implement middleware authentication using the following: import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge'; export default withMiddlewareAuthRequired();
Navigate to a page that should be protected and isn't using page level protection (ex. localhost:3000/profile)
See that the returnTo param is set to localhost:3000/profile instead of /profile
SDK version
2.1.0
Next.js version
13.1
Node.js version
18.12.0
The text was updated successfully, but these errors were encountered:
Checklist
Description
I have implemented
withMiddlewareAuthRequired
to protect our pages. ThereturnTo
param that is added automatically as redirect when navigating to a protected page directly contains the full URL instead of a relative path to the page.I expect a relative URL to be set as described in the docs:
"
/api/auth/login
: Your Next.js application redirects users to your identity provider for them to log in (you can optionally pass a returnTo parameter to return to a custom relative URL after login, for example /api/auth/login?returnTo=/profile)."We host our app as a container and in that environment it still shows localhost as the domain instead of our custom domain. (ex. "/api/auth/login?returnTo=http://localhost:3000/profile")
Also, these docs could use some updates. This import does not work:
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/middleware';
But this does:
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge';
Reproduction
Sample repo: auth0-samples/auth0-nextjs-samples@main...zcarlson-gmgt:auth0-nextjs-samples:main
Implement middleware authentication using the following:
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge'; export default withMiddlewareAuthRequired();
Navigate to a page that should be protected and isn't using page level protection (ex. localhost:3000/profile)
See that the
returnTo
param is set to localhost:3000/profile instead of /profileSDK version
2.1.0
Next.js version
13.1
Node.js version
18.12.0
The text was updated successfully, but these errors were encountered: