fix: magic link JWT (?token=) を先頭スクリプトで localStorage に保存

Made-with: Cursor
This commit is contained in:
posimai 2026-04-21 09:17:07 +09:00
parent e17d2941e3
commit e572dc710e
1 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,26 @@
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex, nofollow">
<!-- JWT / init_keyAuth Gate より先に実行) -->
<script>
(function () {
var u = new URLSearchParams(window.location.search);
var token = u.get('token');
var initKey = u.get('init_key');
if (token) {
localStorage.setItem('posimai_token', token);
u.delete('token');
}
if (initKey) {
localStorage.setItem('posimai_api_key', initKey);
u.delete('init_key');
}
if (token || initKey) {
var newUrl = window.location.pathname + (u.toString() ? '?' + u.toString() : '') + window.location.hash;
window.history.replaceState({}, '', newUrl);
}
})();
</script>
<!-- Auth Gate -->
<script>
(function () {