Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/legal-crabs-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': minor
'@clerk/backend': minor
---

Add `providerUserId` field to `ExternalAccount` resource as the preferred way to access the unique user ID from the OAuth provider. The existing `externalId` field is now deprecated in favor of `providerUserId` for better clarity and consistency across the API.
6 changes: 6 additions & 0 deletions packages/backend/src/api/resources/ExternalAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ export class ExternalAccount {
* The provider name (e.g., `google`).
*/
readonly provider: string,
/**
* The unique ID of the user in the provider.
*/
readonly providerUserId: string,
/**
* The identification with which this external account is associated.
*/
readonly identificationId: string,
/**
* The unique ID of the user in the provider.
* @deprecated Use providerUserId instead
*/
readonly externalId: string,
/**
Expand Down Expand Up @@ -70,6 +75,7 @@ export class ExternalAccount {
return new ExternalAccount(
data.id,
data.provider,
data.provider_user_id,
data.identification_id,
data.provider_user_id,
data.approved_scopes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ describe('External account', () => {
const externalAccountJSON = {
object: 'external_account',
id: targetId,
provider_user_id: 'test_provider_user_id',
identification_id: 'test_identification_id',
};

// @ts-ignore
Expand All @@ -35,6 +37,8 @@ describe('External account', () => {
object: 'external_account',
id: targetId,
deleted: true,
provider_user_id: 'test_provider_user_id',
identification_id: 'test_identification_id',
};

// @ts-ignore
Expand Down