Hello,
In Supertokens, the redirectTo mechanism does not work.
login/signup useAuth call superTokens.redirectToAuth and should use the argument queryParams={redirectToPath:“XXX”} instead of redirectBack: true, where XXX is the redirectTo queryParam of redwood
Here is the code I am using on top of redwood native implementation to enable this feature if it can help
const superTokensClient = {
sessionRecipe: Session,
redirectToAuth: function (options: {
show?: 'signin' | 'signup'
history?: unknown
queryParams?: object
redirectBack: boolean
}): Promise<void> {
const url = new URL(window.location.href)
const redirectTo = url.searchParams.get('redirectTo')
if (!redirectTo) {
return SuperTokens.redirectToAuth(options)
}
const newQueryParams = {
redirectToPath: redirectTo,
...options.queryParams,
}
const newOptions = {
show: options.show,
history: options.history,
queryParams: newQueryParams,
redirectBack: false,
}
return SuperTokens.redirectToAuth(newOptions)
},
}
Also I noticed that the jwks token endpoint on supertokens is continuously hit with no caching. The jwks-rsa native client caching is not working because the jwksClient object is scoped to the authDecoder function in packages/auth-providers/supertokens/api/src/decoder.ts
Maybe worth defining it in a global/singleton ?