Skip to content

Commit d8fcdc2

Browse files
authored
fix(auth): handle 204 No Content response in OAuth client delete (#1786)
1 parent 27e0f0b commit d8fcdc2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/core/auth-js/src/GoTrueAdminApi.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,19 +463,20 @@ export default class GoTrueAdminApi {
463463
*
464464
* This function should only be called on a server. Never expose your `service_role` key in the browser.
465465
*/
466-
private async _deleteOAuthClient(clientId: string): Promise<OAuthClientResponse> {
466+
private async _deleteOAuthClient(
467+
clientId: string
468+
): Promise<{ data: null; error: AuthError | null }> {
467469
try {
468-
return await _request(
470+
await _request(
469471
this.fetch,
470472
'DELETE',
471473
`${this.url}/admin/oauth/clients/${clientId}`,
472474
{
473475
headers: this.headers,
474-
xform: (client: any) => {
475-
return { data: client, error: null }
476-
},
476+
noResolveJson: true,
477477
}
478478
)
479+
return { data: null, error: null }
479480
} catch (error) {
480481
if (isAuthError(error)) {
481482
return { data: null, error }

packages/core/auth-js/src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ export interface GoTrueAdminOAuthApi {
15801580
*
15811581
* This function should only be called on a server. Never expose your `service_role` key in the browser.
15821582
*/
1583-
deleteClient(clientId: string): Promise<OAuthClientResponse>
1583+
deleteClient(clientId: string): Promise<{ data: null; error: AuthError | null }>
15841584

15851585
/**
15861586
* Regenerates the secret for an OAuth client.

0 commit comments

Comments
 (0)