mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix logout SDK auth composable to include auth mode (#21793)
* Fix logout of SDK auth composable to include mode * Add changeset * Update sdk/src/auth/composable.ts * stricter type in refresh --------- Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> Co-authored-by: Brainslug <tim@brainslug.nl>
This commit is contained in:
5
.changeset/nine-coins-pull.md
Normal file
5
.changeset/nine-coins-pull.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/sdk': patch
|
||||
---
|
||||
|
||||
Fixed logout SDK auth composable to include auth mode in request
|
||||
@@ -88,7 +88,7 @@ export const authentication = (mode: AuthenticationMode = 'cookie', config: Part
|
||||
fetchOptions.credentials = authConfig.credentials;
|
||||
}
|
||||
|
||||
const body: Record<string, any> = { mode };
|
||||
const body: Record<string, string> = { mode };
|
||||
|
||||
if (mode === 'json' && authData?.refresh_token) {
|
||||
body['refresh_token'] = authData.refresh_token;
|
||||
@@ -154,12 +154,14 @@ export const authentication = (mode: AuthenticationMode = 'cookie', config: Part
|
||||
fetchOptions.credentials = authConfig.credentials;
|
||||
}
|
||||
|
||||
const body: Record<string, string> = { mode };
|
||||
|
||||
if (mode === 'json' && authData?.refresh_token) {
|
||||
fetchOptions.body = JSON.stringify({
|
||||
refresh_token: authData.refresh_token,
|
||||
});
|
||||
body['refresh_token'] = authData.refresh_token;
|
||||
}
|
||||
|
||||
fetchOptions.body = JSON.stringify(body);
|
||||
|
||||
const requestUrl = getRequestUrl(client.url, '/auth/logout');
|
||||
await request(requestUrl.toString(), fetchOptions, client.globals.fetch);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user