tangled
alpha
login
or
join now
heaths.dev
/
sequoia
forked from
stevedylan.dev/sequoia
0
fork
atom
A CLI for publishing standard.site documents to ATProto
0
fork
atom
overview
issues
pulls
pipelines
Send referrer path and origin through login flow
Heath Stewart
3 weeks ago
c0435192
3c5a3618
+9
-2
1 changed file
expand all
collapse all
unified
split
packages
cli
src
components
sequoia-subscribe.js
+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
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
267
-
// Redirect to the hosted subscribe page to complete OAuth
268
268
-
window.location.href = data.subscribeUrl;
268
268
+
// Redirect to the hosted subscribe page to complete OAuth,
269
269
+
// passing the current page URL (without credentials) as returnTo.
270
270
+
const subscribeUrl = new URL(data.subscribeUrl);
271
271
+
const pageUrl = new URL(window.location.href);
272
272
+
pageUrl.username = "";
273
273
+
pageUrl.password = "";
274
274
+
subscribeUrl.searchParams.set("returnTo", pageUrl.toString());
275
275
+
window.location.href = subscribeUrl.toString();
269
276
return;
270
277
}
271
278