Skip to content

Commit

Permalink
Store token for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
khshourov committed Nov 2, 2024
1 parent 986d4fb commit 4a94a7d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions views/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
</head>
<body>
<div id="root"></div>
<script>
const params = new URLSearchParams(window.location.search);
const token = params.get('token');
if (token) {
// Check if page accessed in plugin context
if (typeof browser !== 'undefined' &&
typeof browser.storage !== 'undefined' &&
typeof browser.storage.local !== 'undefined') {
browser.storage.local.set('authToken', token);
} else {
localStorage.setItem('authToken', token);
}
}
</script>
<script src="{{assetPath 'main.js'}}"></script>
</body>
</html>

0 comments on commit 4a94a7d

Please sign in to comment.