Please include the following information in your post:
- Which SDK this is regarding: @auth0/nextjs-auth0
- SDK Version: 1.7.0
- Platform Version: Node v17.1.0 (on macOS 12.2)
- Code Snippets/Error Messages/Supporting Details/Screenshots:
Is this a feature request or bug report? No.
I am following the instructions referenced here for an SSR protected page.
I am using this snippet with a fresh/clean install of NextJS (version 12.0.10):
export const getServerSideProps = withPageAuthRequired({
async getServerSideProps(ctx) {
console.log("query", ctx.query);
// This was in the documentation but doesn't seem to be needed:
// https://auth0.github.io/nextjs-auth0/modules/helpers_with_page_auth_required.html#withpageauthrequiredoptions
//
// const session = getSession(ctx.req, ctx.res);
return { props: { customProp: "bar" } };
},
});
I am trying to link to a route /test/[id].tsx
This functions correctly when I omit returnTo
but it changes the URL to: http://localhost:3000/test/something?id=something
instead of http://localhost:3000/test/something
If I set the returnTo
value to /test/something
the URL is fine.
Is there a way to set the returnTo
dynamically? Or am I doing something incorrect? Or is it just something I will have to live with?
Thanks a lot!
Marc