Skip to content

Commit

Permalink
fixup allow to change the clientId only
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Nov 16, 2023
1 parent 9831a4e commit 979140a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export class JsonRpcAuthProviderClient implements PromiseClient<typeof AuthProvi
if (!request.authProviderId) {
throw new ConnectError("authProviderId is required", Code.InvalidArgument);
}
const clientId = request?.clientId;
const clientSecret = request?.clientSecret;
if (!clientId || !clientSecret) {
const clientId = request?.clientId || "";
const clientSecret = request?.clientSecret || "";
if (!clientId && !clientSecret) {
throw new ConnectError("clientId or clientSecret are required", Code.InvalidArgument);
}

Expand Down
8 changes: 5 additions & 3 deletions components/server/src/auth/auth-provider-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ export class AuthProviderService {
if (!existing) {
throw new ApplicationError(ErrorCodes.NOT_FOUND, "Provider resource not found.");
}
const changed =
entry.clientId !== existing.oauth.clientId ||
(entry.clientSecret && entry.clientSecret !== existing.oauth.clientSecret);

// Explicitly check if any update needs to be performed
const changedId = entry.clientId && entry.clientId !== existing.oauth.clientId;
const changedSecret = entry.clientSecret && entry.clientSecret !== existing.oauth.clientSecret;
const changed = changedId || changedSecret;

if (!changed) {
return existing;
Expand Down

0 comments on commit 979140a

Please sign in to comment.