Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions patchnotes-web/src/auth/stytch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ if (import.meta.env.DEV) {
}

export function getStytchLoginConfig(returnUrl?: string) {
const base = `${window.location.origin}/authenticate`
const redirectURL = returnUrl
? `${base}?returnUrl=${encodeURIComponent(returnUrl)}`
: base
if (returnUrl) {
localStorage.setItem('stytch_return_url', returnUrl)
}
const redirectURL = `${window.location.origin}/authenticate`

return {
products,
Expand Down
5 changes: 4 additions & 1 deletion patchnotes-web/src/pages/Authenticate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export function Authenticate() {

const { token, tokenType, returnUrl } = useMemo(() => {
const params = new URLSearchParams(window.location.search)
const raw = params.get('returnUrl')
// Check localStorage first, then fall back to query param for backwards compat
const stored = localStorage.getItem('stytch_return_url')
localStorage.removeItem('stytch_return_url')
const raw = stored ?? params.get('returnUrl')
return {
token: params.get('token'),
tokenType: params.get('stytch_token_type'),
Expand Down