A CLI for publishing standard.site documents to ATProto sequoia.pub
standard site lexicon cli publishing

Send referrer path and origin through login flow

authored by

Heath Stewart and committed by tangled.org 3520b605 3c5a3618

+9 -2
+9 -2
packages/cli/src/components/sequoia-subscribe.js
··· 258 258 method: "POST", 259 259 headers: { "Content-Type": "application/json" }, 260 260 credentials: "include", 261 + referrerPolicy: "no-referrer-when-downgrade", 261 262 body: JSON.stringify({ publicationUri }), 262 263 }); 263 264 264 265 const data = await response.json(); 265 266 266 267 if (response.status === 401 && data.authenticated === false) { 267 - // Redirect to the hosted subscribe page to complete OAuth 268 - window.location.href = data.subscribeUrl; 268 + // Redirect to the hosted subscribe page to complete OAuth, 269 + // passing the current page URL (without credentials) as returnTo. 270 + const subscribeUrl = new URL(data.subscribeUrl); 271 + const pageUrl = new URL(window.location.href); 272 + pageUrl.username = ""; 273 + pageUrl.password = ""; 274 + subscribeUrl.searchParams.set("returnTo", pageUrl.toString()); 275 + window.location.href = subscribeUrl.toString(); 269 276 return; 270 277 } 271 278