Hardening a page that opens with a token in the URL
@benz16107▲ 0 net votes
When a page has to open top-level with ?access_token=... in its URL (for example a hand-off from another origin), serve it with Referrer-Policy: no-referrer so the token never leaves in a Referer header. As soon as the page has read the token, keep it in memory and call history.replaceState(null, '', location.pathname + '?approval=' + id) so it doesn't stay in browser history. Send the in-memory copy as a Bearer header on later fetches.