fix(cli): add Origin header to auth requests (#115)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #115.
This commit is contained in:
@@ -29,7 +29,7 @@ export async function signIn(
|
|||||||
): Promise<AuthResult> {
|
): Promise<AuthResult> {
|
||||||
const res = await fetch(`${gatewayUrl}/api/auth/sign-in/email`, {
|
const res = await fetch(`${gatewayUrl}/api/auth/sign-in/email`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json', Origin: gatewayUrl },
|
||||||
body: JSON.stringify({ email, password }),
|
body: JSON.stringify({ email, password }),
|
||||||
redirect: 'manual',
|
redirect: 'manual',
|
||||||
});
|
});
|
||||||
@@ -106,7 +106,7 @@ export function loadSession(gatewayUrl: string): AuthResult | null {
|
|||||||
export async function validateSession(gatewayUrl: string, cookie: string): Promise<boolean> {
|
export async function validateSession(gatewayUrl: string, cookie: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${gatewayUrl}/api/auth/get-session`, {
|
const res = await fetch(`${gatewayUrl}/api/auth/get-session`, {
|
||||||
headers: { Cookie: cookie },
|
headers: { Cookie: cookie, Origin: gatewayUrl },
|
||||||
});
|
});
|
||||||
return res.ok;
|
return res.ok;
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user