Skip to content

Commit

Permalink
Merge pull request #537 from nhost/magic-link-login-redirect
Browse files Browse the repository at this point in the history
Always redirect on login with magic link
  • Loading branch information
Johan Eliasson authored Jun 1, 2021
2 parents 1bd60b3 + ae2d934 commit ba9a767
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/routes/auth/magic-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ async function magicLink({ query }: Request, res: Response): Promise<unknown> {
if (!useCookie) session.refresh_token = refresh_token

if (action === 'log-in') {
if (APPLICATION.REDIRECT_URL_SUCCESS) {
return res.redirect(`${APPLICATION.REDIRECT_URL_SUCCESS}?refresh_token=${refresh_token}`)
}

return res.status(200).send('You have logged in')
return res.redirect(`${APPLICATION.REDIRECT_URL_SUCCESS}?refresh_token=${refresh_token}`)
} else if (action === 'sign-up') {
if(APPLICATION.REDIRECT_URL_SUCCESS) {
return res.redirect(APPLICATION.REDIRECT_URL_SUCCESS.replace('JWT_TOKEN', token))
Expand Down

0 comments on commit ba9a767

Please sign in to comment.