Strip leading "Bearer " when saving the BCP auth token
DevTools' "Copy value" on the authorization header includes the "Bearer " prefix, so accept and normalize it instead of requiring users to trim it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRS5Lvcig4TNpPyviUooGa
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
<li>Open your browser's developer tools (<kbd class="kbd kbd-sm">F12</kbd>, or right-click → Inspect) and switch to the <span class="font-semibold">Network</span> tab.</li>
|
||||
<li>Back on BCP, open any event or your profile so the page makes a new request — refreshing the page works.</li>
|
||||
<li>In the Network tab, click any request to <span class="font-mono">newprod-api.bestcoastpairings.com</span>.</li>
|
||||
<li>Find the <span class="font-mono">authorization</span> request header. Copy everything after <span class="font-mono">Bearer </span> — that's your token.</li>
|
||||
<li>Find the <span class="font-mono">authorization</span> request header and copy its value (pasting the whole thing, including the leading "Bearer ", is fine).</li>
|
||||
<li>Paste it into the field above and click <span class="font-semibold">Save</span>.</li>
|
||||
</ol>
|
||||
<p class="text-xs opacity-50 mt-3">
|
||||
|
||||
@@ -144,7 +144,10 @@ async function loadItcRanks(userIds) {
|
||||
never committed, never part of the deployed bundle. */
|
||||
const TOKEN_KEY = "bcp_auth_token";
|
||||
const getToken = () => { try { return localStorage.getItem(TOKEN_KEY) || ""; } catch { return ""; } };
|
||||
const setToken = t => { try { t ? localStorage.setItem(TOKEN_KEY, t) : localStorage.removeItem(TOKEN_KEY); } catch {} };
|
||||
const setToken = t => {
|
||||
t = t.replace(/^bearer\s+/i, "");
|
||||
try { t ? localStorage.setItem(TOKEN_KEY, t) : localStorage.removeItem(TOKEN_KEY); } catch {}
|
||||
};
|
||||
|
||||
// This event tracks the five ITC-standard mission dispositions. Hand-typed
|
||||
// sources (a "Dispositions Used:" line in a submitted list, BCP's own free
|
||||
@@ -829,6 +832,7 @@ $("disposition-toggle").addEventListener("click", () => {
|
||||
$("bcp-token-input").value = getToken();
|
||||
$("bcp-token-save").addEventListener("click", () => {
|
||||
setToken($("bcp-token-input").value.trim());
|
||||
$("bcp-token-input").value = getToken();
|
||||
if (state) startBackfill(state.event);
|
||||
});
|
||||
$("bcp-token-clear").addEventListener("click", () => {
|
||||
|
||||
Reference in New Issue
Block a user