Article

Tutorial: routing account.gocools sign-in back into your app

A practical redirect pattern for teams that want account.gocools to handle authentication without losing the user’s intended destination.

Tutorial: routing account.gocools sign-in back into your app

Keep the return path explicit

When account.gocools owns authentication, the application initiating sign-in should preserve where the user was trying to go.

Store the intended path and send it to account.gocools as a return URL.

const returnUrl = encodeURIComponent('https://blog.gocools.com/editor')
window.location.href = 'https://account.gocools.com/login?returnUrl=' + returnUrl

Implementation notes

  • keep the return URL absolute
  • only allow approved origins on the account side
  • redirect users back to an actionable destination, not a dead-end page

Why this matters

A clean handoff makes the product feel unified even when authentication lives outside the app surface.

Comments

Reader discussion

Approved comments are published below. New submissions go through moderation before they appear on the article.

No approved comments yet. Start the discussion.