Skip to content

Role of externalId #180

@nomocas

Description

@nomocas

Hi All,

The context

We have a special case where all our users must be invited to use our app, and we don't want the invitee to go through clerk signup process. In fact, we only use clerk for sign-in through our custom components.

So, to allow them to sign in, we need to add our users in clerk DB only when they accept our invitation, programmatically through our backend (nodejs).

The question

What is the role of and how to use externalId?

We could add it through api:

createUser({
    externalId: '...',
    emailAddress:['[email protected]']
})

i.e.:

type CreateUserParams = {
  externalId?: string;
  emailAddress?: string[];
  phoneNumber?: string[];
  username?: string;
  password?: string;
  firstName?: string;
  lastName?: string;
  skipPasswordChecks?: boolean;
  skipPasswordRequirement?: boolean;
} & UserMetadataParams;

But we could not query with it:

  • getUser(userId:string) returns a 404 as userId is not externalId
  • and getUserList(params: UserListParams = {}) or getCount(params: UserListParams = {}) are using UserCountParams which does not contain it.

i.e.:

type UserCountParams = {
  emailAddress?: string[];
  phoneNumber?: string[];
  username?: string[];
  web3Wallet?: string[];
  query?: string;
  userId?: string[];
};

type UserListParams = UserCountParams & {
  limit?: number;
  offset?: number;
  orderBy?: 'created_at' | 'updated_at' | '+created_at' | '+updated_at' | '-created_at' | '-updated_at';
};

So how to use externalId?

If we add it in UserMetadataParams, same thing: how to query it through metadata as metadata are not allowed in UserCountParams

By the way: externalId is not shown in clerk dashboard (user section). I think it should be good to show it there.

Thanks for answering. ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions