Skip to content

Commit

Permalink
Revoke should provide clientId
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlong committed Oct 10, 2024
1 parent 5b5b176 commit e792fc0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@ class RingCentral implements RingCentralInterface {
// nothing to revoke
return;
}
if (!this.rest.clientId || !this.rest.clientSecret) {
// no clientId or clientSecret, the token is from external source, cannot revoke
if (!this.rest.clientId) {
// if no clientId, the token is from external source, cannot revoke
// no clientSecret is fine, since PKCE doesn't have clientSecret
return;
}
const temp = tokenToRevoke ?? this.token?.access_token ?? this.token?.refresh_token;
await this.restapi(null).oauth().revoke().post({ token: temp });
await this.restapi(null)
.oauth()
.revoke()
.post({ token: temp, client_id: this.rest.clientId } as any); // todo: spec doesn't allow client_id
this.token = undefined;
}

Expand Down

0 comments on commit e792fc0

Please sign in to comment.