Remove credentials: 'include', a mechanism that we don't actually use.
This commit is contained in:
@@ -84,7 +84,7 @@ async function makeApiCall(page: Page, url: string, method = 'GET'): Promise<{ s
|
|||||||
// Wait a tick for the page's handler to retry, then make our own call
|
// Wait a tick for the page's handler to retry, then make our own call
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, { method, credentials: 'include' });
|
const response = await fetch(url, { method });
|
||||||
if (response.status === 204) {
|
if (response.status === 204) {
|
||||||
resolve({ status: 204 });
|
resolve({ status: 204 });
|
||||||
} else if (response.ok) {
|
} else if (response.ok) {
|
||||||
@@ -111,7 +111,7 @@ async function makeApiCall(page: Page, url: string, method = 'GET'): Promise<{ s
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (resolved) return;
|
if (resolved) return;
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, { method, credentials: 'include' });
|
const response = await fetch(url, { method });
|
||||||
// Only resolve if this is a success or non-auth error
|
// Only resolve if this is a success or non-auth error
|
||||||
if (response.status !== 401 && response.status !== 403) {
|
if (response.status !== 401 && response.status !== 403) {
|
||||||
if (resolved) return;
|
if (resolved) return;
|
||||||
|
|||||||
+2
-2
@@ -96,7 +96,7 @@
|
|||||||
async function apiCall(url, method = 'GET') {
|
async function apiCall(url, method = 'GET') {
|
||||||
log(`${method} ${url}...`);
|
log(`${method} ${url}...`);
|
||||||
|
|
||||||
const response = await fetch(url, { method, credentials: 'include' });
|
const response = await fetch(url, { method });
|
||||||
|
|
||||||
// Server returns 401 (login/reauth) or 403 (missing permissions)
|
// Server returns 401 (login/reauth) or 403 (missing permissions)
|
||||||
// with a JSON body containing the iframe URL for authentication
|
// with a JSON body containing the iframe URL for authentication
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await fetch('/auth/api/logout', { method: 'POST', credentials: 'include' });
|
await fetch('/auth/api/logout', { method: 'POST' });
|
||||||
log('Logged out');
|
log('Logged out');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export async function getAuthIframeUrl(mode = 'login') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch from forward endpoint - it returns URL in auth.iframe on 401/403
|
// Fetch from forward endpoint - it returns URL in auth.iframe on 401/403
|
||||||
const response = await fetch('/auth/api/forward', { credentials: 'include' })
|
const response = await fetch('/auth/api/forward')
|
||||||
if (response.status === 401 || response.status === 403) {
|
if (response.status === 401 || response.status === 403) {
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
if (data.auth?.iframe) {
|
if (data.auth?.iframe) {
|
||||||
@@ -321,7 +321,6 @@ export async function apiJson(url, options = {}) {
|
|||||||
*/
|
*/
|
||||||
export async function fetchJson(url, options = {}) {
|
export async function fetchJson(url, options = {}) {
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
credentials: 'include',
|
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
|||||||
Reference in New Issue
Block a user