Repository: auth0/auth0-spa-js
Pull request #956 (2022-08-16 15:19:31)

[SDK-3547] Rename client_id to clientId
<!-- By submitting a PR to this repository, you agree to the terms within the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md). Please see the [contributing guidelines](https://github.com/auth0/.github/blob/master/CONTRIBUTING.md) for how to create and submit a high-quality PR for this repo. -->

### Changes

<!--
Please describe both what is changing and why this is important. Include:
- Classes and methods added, deleted, deprecated, or changed
- Screenshots of new or changed UI, if applicable
- A summary of usage if this is a new feature or change to a public API (this should also be added to relevant documentation once released)
-->

Renames `client_id` on the public API to `clientId` for consistency with the JS ecosystems preference for camelCase, whilst maintaining sending `client_id` back to Auth0 in requests.

For consistencies sake within the codebase, except for `CacheEntry` the cache related code was also updated to use `clientId` over `client_id`. `CacheEntry` was not migrated to not break existing cached data

This will require users of this package to rename the property on their side. The diff for this looks like as follows

* `Auth0Client` constructor
```diff
const auth0 = new Auth0Client({
  domain: '<AUTH0_DOMAIN>',
- client_id: '<AUTH0_CLIENT_ID>'
+ clientId: '<AUTH0_CLIENT_ID>'
});
```
* `createAuth0Client` helper
```diff
const auth0 = await createAuth0Client({
  domain: '<AUTH0_DOMAIN>',
- client_id: '<AUTH0_CLIENT_ID>'
+ clientId: '<AUTH0_CLIENT_ID>'
});
```

This change also applies to the `buildLogoutUrl` and `logout` methods on `Auth0Client`.


However, if you are implementing a custom cache the `CacheEntry` structure still maintains the snakecase `client_id` for backwards compatibility with existing cached data so there is no migration needed for custom cache implementations.

### Checklist

- [x] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
- [x] I have read the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
- [x] All code quality tools/guidelines have been run/followed



Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 6ae03c1..c39ba95 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -65,7 +65,7 @@ jobs:
               import { Auth0Client } from '@auth0/auth0-spa-js';
               new Auth0Client({
                 domain: 'DOMAIN',
-                client_id: 'CLIENT_ID'
+                clientId: 'CLIENT_ID'
               });
       - run:
           name: Build App
@@ -98,7 +98,7 @@ jobs:
               import { Auth0Client } from '@auth0/auth0-spa-js';
               new Auth0Client({
                 domain: 'DOMAIN',
-                client_id: 'CLIENT_ID'
+                clientId: 'CLIENT_ID'
               });
       - run:
           name: Build App
@@ -132,7 +132,7 @@ jobs:
               import { Auth0Client } from '@auth0/auth0-spa-js';
               new Auth0Client({
                 domain: 'DOMAIN',
-                client_id: 'CLIENT_ID'
+                clientId: 'CLIENT_ID'
               });
       - run:
           name: Build App
@@ -165,7 +165,7 @@ jobs:
               import { Auth0Client } from '@auth0/auth0-spa-js';
               new Auth0Client({
                 domain: 'DOMAIN',
-                client_id: 'CLIENT_ID'
+                clientId: 'CLIENT_ID'
               });
       - run:
           name: Build App
diff --git a/README.md b/README.md
index af2ebc0..1c528b3 100644
--- a/README.md
+++ b/README.md
@@ -80,14 +80,14 @@ import { createAuth0Client } from '@auth0/auth0-spa-js';
 //with async/await
 const auth0 = await createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>'
 });
 
 //with promises
 createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>'
 }).then(auth0 => {
   //...
@@ -98,7 +98,7 @@ import { Auth0Client } from '@auth0/auth0-spa-js';
 
 const auth0 = new Auth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>'
 });
 
@@ -224,7 +224,7 @@ To use the in-memory mode, no additional options need are required as this is th
 ```js
 await createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>',
   cacheLocation: 'localstorage' // valid values are: 'memory' or 'localstorage'
 });
@@ -271,7 +271,7 @@ const sessionStorageCache = {
 
 await createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>',
   cache: sessionStorageCache
 });
@@ -290,7 +290,7 @@ To enable the use of refresh tokens, set the `useRefreshTokens` option to `true`
 ```js
 await createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>',
   useRefreshTokens: true
 });
@@ -319,7 +319,7 @@ Log in to an organization by specifying the `organization` parameter when settin
 ```js
 createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   redirect_uri: '<MY_CALLBACK_URL>',
   organization: '<MY_ORG_ID>'
 });
@@ -364,7 +364,7 @@ Advanced options can be set by specifying the `advancedOptions` property when co
 ```js
 createAuth0Client({
   domain: '<AUTH0_DOMAIN>',
-  client_id: '<AUTH0_CLIENT_ID>',
+  clientId: '<AUTH0_CLIENT_ID>',
   advancedOptions: {
     defaultScope: 'email' // change the scopes that are applied to every authz request. **Note**: `openid` is always specified regardless of this setting
   }
diff --git a/src/Auth0Client.ts b/src/Auth0Client.ts
index 0120bc8..cfeb9d0 100644
--- a/src/Auth0Client.ts
+++ b/src/Auth0Client.ts
@@ -169,7 +169,7 @@ const getCustomInitialOptions = (
     authorizeTimeoutInSeconds,
     cacheLocation,
     cache,
-    client_id,
+    clientId,
     domain,
     issuer,
     leeway,
@@ -248,11 +248,11 @@ export class Auth0Client {
         : CookieStorageWithLegacySameSite;
 
     this.orgHintCookieName = buildOrganizationHintCookieName(
-      this.options.client_id
+      this.options.clientId
     );
 
     this.isAuthenticatedCookieName = buildIsAuthenticatedCookieName(
-      this.options.client_id
+      this.options.clientId
     );
 
     this.sessionCheckExpiryDays =
@@ -266,7 +266,7 @@ export class Auth0Client {
 
     this.transactionManager = new TransactionManager(
       transactionStorage,
-      this.options.client_id
+      this.options.clientId
     );
 
     this.nowProvider = this.options.nowProvider || DEFAULT_NOW_PROVIDER;
@@ -274,7 +274,7 @@ export class Auth0Client {
     this.cacheManager = new CacheManager(
       cache,
       !cache.allKeys
-        ? new CacheKeyManifest(cache, this.options.client_id)
+        ? new CacheKeyManifest(cache, this.options.clientId)
         : null,
       this.nowProvider
     );
@@ -376,7 +376,7 @@ export class Auth0Client {
 
     return verifyIdToken({
       iss: this.tokenIssuer,
-      aud: this.options.client_id,
+      aud: this.options.clientId,
       id_token,
       nonce,
       organizationId,
@@ -545,7 +545,7 @@ export class Auth0Client {
         audience: params.audience,
         scope: params.scope,
         baseUrl: this.domainUrl,
-        client_id: this.options.client_id,
+        client_id: this.options.clientId,
         code_verifier,
         code: codeResult.code,
         grant_type: 'authorization_code',
@@ -570,7 +570,7 @@ export class Auth0Client {
       decodedToken,
       scope: params.scope,
       audience: params.audience || 'default',
-      client_id: this.options.client_id
+      client_id: this.options.clientId
     };
 
     await this.cacheManager.set(cacheEntry);
@@ -606,7 +606,7 @@ export class Auth0Client {
 
     const cache = await this.cacheManager.get(
       new CacheKey({
-        client_id: this.options.client_id,
+        clientId: this.options.clientId,
         audience,
         scope
       })
@@ -636,7 +636,7 @@ export class Auth0Client {
 
     const cache = await this.cacheManager.get(
       new CacheKey({
-        client_id: this.options.client_id,
+        clientId: this.options.clientId,
         audience,
         scope
       })
@@ -725,7 +725,7 @@ export class Auth0Client {
       audience: transaction.audience,
       scope: transaction.scope,
       baseUrl: this.domainUrl,
-      client_id: this.options.client_id,
+      client_id: this.options.clientId,
       code_verifier: transaction.code_verifier,
       grant_type: 'authorization_code',
       code,
@@ -753,7 +753,7 @@ export class Auth0Client {
       audience: transaction.audience,
       scope: transaction.scope,
       ...(authResult.scope ? { oauthTokenScope: authResult.scope } : null),
-      client_id: this.options.client_id
+      client_id: this.options.clientId
     });
 
     this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
@@ -883,7 +883,7 @@ export class Auth0Client {
           cacheMode,
           ...getTokenOptions
         }),
-      `${this.options.client_id}::${getTokenOptions.audience}::${getTokenOptions.scope}`
+      `${this.options.clientId}::${getTokenOptions.audience}::${getTokenOptions.scope}`
     );
   }
 
@@ -898,7 +898,7 @@ export class Auth0Client {
       const entry = await this._getEntryFromCache({
         scope: getTokenOptions.scope,
         audience: getTokenOptions.audience || 'default',
-        client_id: this.options.client_id,
+        clientId: this.options.clientId,
         getDetailedEntry: options.detailedResponse
       });
 
@@ -924,7 +924,7 @@ export class Auth0Client {
           const entry = await this._getEntryFromCache({
             scope: getTokenOptions.scope,
             audience: getTokenOptions.audience || 'default',
-            client_id: this.options.client_id,
+            clientId: this.options.clientId,
             getDetailedEntry: options.detailedResponse
           });
 
@@ -938,7 +938,7 @@ export class Auth0Client {
           : await this._getTokenFromIFrame(getTokenOptions);
 
         await this.cacheManager.set({
-          client_id: this.options.client_id,
+          client_id: this.options.clientId,
           ...authResult
         });
 
@@ -1003,7 +1003,7 @@ export class Auth0Client {
       new CacheKey({
         scope: options.scope,
         audience: options.audience || 'default',
-        client_id: this.options.client_id
+        clientId: this.options.clientId
       })
     );
 
@@ -1033,10 +1033,10 @@ export class Auth0Client {
    * @param options
    */
   public buildLogoutUrl(options: LogoutUrlOptions = {}): string {
-    if (options.client_id !== null) {
-      options.client_id = options.client_id || this.options.client_id;
+    if (options.clientId !== null) {
+      options.clientId = options.clientId || this.options.clientId;
     } else {
-      delete options.client_id;
+      delete options.clientId;
     }
 
     const { federated, ...logoutOptions } = options;
@@ -1164,7 +1164,7 @@ export class Auth0Client {
           scope,
           audience,
           baseUrl: this.domainUrl,
-          client_id: this.options.client_id,
+          client_id: this.options.clientId,
           code_verifier,
           code: codeResult.code,
           grant_type: 'authorization_code',
@@ -1213,7 +1213,7 @@ export class Auth0Client {
       new CacheKey({
         scope: options.scope,
         audience: options.audience || 'default',
-        client_id: this.options.client_id
+        clientId: this.options.clientId
       })
     );
 
@@ -1261,7 +1261,7 @@ export class Auth0Client {
           audience,
           scope,
           baseUrl: this.domainUrl,
-          client_id: this.options.client_id,
+          client_id: this.options.clientId,
           grant_type: 'refresh_token',
           refresh_token: cache && cache.refresh_token,
           redirect_uri,
@@ -1303,19 +1303,19 @@ export class Auth0Client {
   private async _getEntryFromCache({
     scope,
     audience,
-    client_id,
+    clientId,
     getDetailedEntry = false
   }: {
     scope: string;
     audience: string;
-    client_id: string;
+    clientId: string;
     getDetailedEntry?: boolean;
   }) {
     const entry = await this.cacheManager.get(
       new CacheKey({
         scope,
         audience,
-        client_id
+        clientId
       }),
       60 // get a new token if within 60 seconds of expiring
     );
diff --git a/src/cache/cache-manager.ts b/src/cache/cache-manager.ts
index 13960ac..d83a443 100644
--- a/src/cache/cache-manager.ts
+++ b/src/cache/cache-manager.ts
@@ -69,7 +69,7 @@ export class CacheManager {
 
   async set(entry: CacheEntry): Promise<void> {
     const cacheKey = new CacheKey({
-      client_id: entry.client_id,
+      clientId: entry.client_id,
       scope: entry.scope,
       audience: entry.audience
     });
@@ -135,10 +135,10 @@ export class CacheManager {
 
   /**
    * Finds the corresponding key in the cache based on the provided cache key.
-   * The keys inside the cache are in the format {prefix}::{client_id}::{audience}::{scope}.
+   * The keys inside the cache are in the format {prefix}::{clientId}::{audience}::{scope}.
    * The first key in the cache that satisfies the following conditions is returned
    *  - `prefix` is strict equal to Auth0's internally configured `keyPrefix`
-   *  - `client_id` is strict equal to the `cacheKey.client_id`
+   *  - `clientId` is strict equal to the `cacheKey.clientId`
    *  - `audience` is strict equal to the `cacheKey.audience`
    *  - `scope` contains at least all the `cacheKey.scope` values
    *  *
@@ -160,7 +160,7 @@ export class CacheManager {
 
       return (
         cacheKey.prefix === CACHE_KEY_PREFIX &&
-        cacheKey.client_id === keyToMatch.client_id &&
+        cacheKey.clientId === keyToMatch.clientId &&
         cacheKey.audience === keyToMatch.audience &&
         hasAllScopes
       );
diff --git a/src/cache/shared.ts b/src/cache/shared.ts
index ca02a95..0d98897 100644
--- a/src/cache/shared.ts
+++ b/src/cache/shared.ts
@@ -5,16 +5,16 @@ export const CACHE_KEY_PREFIX = '@@auth0spajs@@';
 export type CacheKeyData = {
   audience: string;
   scope: string;
-  client_id: string;
+  clientId: string;
 };
 
 export class CacheKey {
-  public client_id: string;
+  public clientId: string;
   public scope: string;
   public audience: string;
 
   constructor(data: CacheKeyData, public prefix: string = CACHE_KEY_PREFIX) {
-    this.client_id = data.client_id;
+    this.clientId = data.clientId;
     this.scope = data.scope;
     this.audience = data.audience;
   }
@@ -24,7 +24,7 @@ export class CacheKey {
    * @returns A string representation of the key
    */
   toKey(): string {
-    return `${this.prefix}::${this.client_id}::${this.audience}::${this.scope}`;
+    return `${this.prefix}::${this.clientId}::${this.audience}::${this.scope}`;
   }
 
   /**
@@ -33,9 +33,9 @@ export class CacheKey {
    * @returns An instance of `CacheKey`
    */
   static fromKey(key: string): CacheKey {
-    const [prefix, client_id, audience, scope] = key.split('::');
+    const [prefix, clientId, audience, scope] = key.split('::');
 
-    return new CacheKey({ client_id, scope, audience }, prefix);
+    return new CacheKey({ clientId, scope, audience }, prefix);
   }
 
   /**
@@ -44,12 +44,12 @@ export class CacheKey {
    * @returns An instance of `CacheKey`
    */
   static fromCacheEntry(entry: CacheEntry): CacheKey {
-    const { scope, audience, client_id } = entry;
+    const { scope, audience, client_id: clientId } = entry;
 
     return new CacheKey({
       scope,
       audience,
-      client_id
+      clientId
     });
   }
 }
diff --git a/src/global.ts b/src/global.ts
index 1ed5d5e..bc00601 100644
--- a/src/global.ts
+++ b/src/global.ts
@@ -121,7 +121,7 @@ export interface Auth0ClientOptions extends BaseLoginOptions {
   /**
    * The Client ID found on your Application settings page
    */
-  client_id: string;
+  clientId: string;
   /**
    * The default URL where Auth0 will redirect your browser to with
    * the authentication result. It must be whitelisted in
@@ -421,10 +421,10 @@ export interface LogoutUrlOptions {
   /**
    * The URL where Auth0 will redirect your browser to after the logout.
    *
-   * **Note**: If the `client_id` parameter is included, the
+   * **Note**: If the `clientId` parameter is included, the
    * `returnTo` URL that is provided must be listed in the
    * Application's "Allowed Logout URLs" in the Auth0 dashboard.
-   * However, if the `client_id` parameter is not included, the
+   * However, if the `clientId` parameter is not included, the
    * `returnTo` URL must be listed in the "Allowed Logout URLs" at
    * the account level in the Auth0 dashboard.
    *
@@ -433,15 +433,15 @@ export interface LogoutUrlOptions {
   returnTo?: string;
 
   /**
-   * The `client_id` of your application.
+   * The `clientId` of your application.
    *
-   * If this property is not set, then the `client_id` that was used during initialization of the SDK is sent to the logout endpoint.
+   * If this property is not set, then the `clientId` that was used during initialization of the SDK is sent to the logout endpoint.
    *
    * If this property is set to `null`, then no client ID value is sent to the logout endpoint.
    *
    * [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
    */
-  client_id?: string;
+   clientId?: string;
 
   /**
    * When supported by the upstream identity provider,
@@ -456,10 +456,10 @@ export interface LogoutOptions {
   /**
    * The URL where Auth0 will redirect your browser to after the logout.
    *
-   * **Note**: If the `client_id` parameter is included, the
+   * **Note**: If the `clientId` parameter is included, the
    * `returnTo` URL that is provided must be listed in the
    * Application's "Allowed Logout URLs" in the Auth0 dashboard.
-   * However, if the `client_id` parameter is not included, the
+   * However, if the `clientId` parameter is not included, the
    * `returnTo` URL must be listed in the "Allowed Logout URLs" at
    * the account level in the Auth0 dashboard.
    *
@@ -468,15 +468,15 @@ export interface LogoutOptions {
   returnTo?: string;
 
   /**
-   * The `client_id` of your application.
+   * The `clientId` of your application.
    *
-   * If this property is not set, then the `client_id` that was used during initialization of the SDK is sent to the logout endpoint.
+   * If this property is not set, then the `clientId` that was used during initialization of the SDK is sent to the logout endpoint.
    *
    * If this property is set to `null`, then no client ID value is sent to the logout endpoint.
    *
    * [Read more about how redirecting after logout works](https://auth0.com/docs/logout/guides/redirect-users-after-logout)
    */
-  client_id?: string;
+   clientId?: string;
 
   /**
    * When supported by the upstream identity provider,
diff --git a/src/utils.ts b/src/utils.ts
index 6382863..fa3df1f 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -164,8 +164,8 @@ const stripUndefined = (params: any) => {
     .reduce((acc, key) => ({ ...acc, [key]: params[key] }), {});
 };
 
-export const createQueryParams = (params: any) => {
-  return new URLSearchParams(stripUndefined(params)).toString();
+export const createQueryParams = ({ clientId: client_id, ...params }: any) => {
+  return new URLSearchParams(stripUndefined({ client_id, ...params })).toString();
 };
 
 export const sha256 = async (s: string) => {
diff --git a/static/index.html b/static/index.html
index 01df26e..8e6a1a5 100644
--- a/static/index.html
+++ b/static/index.html
@@ -197,11 +197,11 @@
         </div>
 
         <div class="form-group">
-          <label for="client_id">Client ID</label>
+          <label for="clientId">Client ID</label>
           <input
             type="text"
             class="form-control"
-            id="client_id"
+            id="clientId"
             v-model="clientId"
             data-cy="client-id"
           />
@@ -522,7 +522,7 @@
 
             var clientOptions = {
               domain: _self.domain,
-              client_id: _self.clientId,
+              clientId: _self.clientId,
               cacheLocation: _self.useLocalStorage ? 'localstorage' : 'memory',
               useRefreshTokens: _self.useRefreshTokens,
               useCookiesForTransactions: _self.useCookiesForTransactions,
@@ -761,7 +761,7 @@
           },
           logoutNoClient: function () {
             this.auth0.logout({
-              client_id: null,
+              clientId: null,
               returnTo: window.location.origin
             });
           },
diff --git a/static/multiple_clients.html b/static/multiple_clients.html
index a707bba..f3c9a2e 100644
--- a/static/multiple_clients.html
+++ b/static/multiple_clients.html
@@ -30,7 +30,7 @@
         <div class="mb-5" v-for="client in clients" :key="client.id">
           <h2 v-text="client.name" class="text-2xl"></h2>
           <p class="text-gray-400" v-text="client.description"></p>
-          <p class="text-gray-400 mb-5" v-text="client.options.client_id"></p>
+          <p class="text-gray-400 mb-5" v-text="client.options.clientId"></p>
           <button
             type="submit"
             class="p-2 rounded bg-blue-700 text-white"
@@ -99,7 +99,7 @@
                 id: 1,
                 options: {
                   ...commonOptions,
-                  client_id: useAuth0
+                  clientId: useAuth0
                     ? 'IRLdsf27vEPiV5NNQjlNK7fwgmRuwyJY'
                     : 'multi-client-1'
                 },
@@ -115,7 +115,7 @@
                 id: 2,
                 options: {
                   ...commonOptions,
-                  client_id: useAuth0
+                  clientId: useAuth0
                     ? 'Q4TgHIYRcUBh2xe6l049ZR7X5JAeLzwI'
                     : 'multi-client-2',
                   useRefreshTokens: true
@@ -132,7 +132,7 @@
                 id: 3,
                 options: {
                   ...commonOptions,
-                  client_id: useAuth0
+                  clientId: useAuth0
                     ? 'Y7VQRCOOVeU7b0Y36cLA5OS4fUbIJfwV'
                     : 'multi-client-3',
                   useCookiesForTransactions: true
@@ -202,7 +202,7 @@
           logoutOf(client) {
             client.auth0.logout({
               returnTo: `${window.location.origin}/multiple_clients.html`,
-              client_id: client.options.client_id
+              clientId: client.options.clientId
             });
           }
         }


Test patch:
diff --git a/__tests__/Auth0Client/buildLogoutUrl.test.ts b/__tests__/Auth0Client/buildLogoutUrl.test.ts
index 572ee64..92b3380 100644
--- a/__tests__/Auth0Client/buildLogoutUrl.test.ts
+++ b/__tests__/Auth0Client/buildLogoutUrl.test.ts
@@ -83,14 +83,14 @@ describe('Auth0Client', () => {
     it('creates correct query params with `options.client_id` is null', async () => {
       const auth0 = setup();
 
-      const url = new URL(auth0.buildLogoutUrl({ client_id: null }));
+      const url = new URL(auth0.buildLogoutUrl({ clientId: null }));
       expect(url.searchParams.get('client_id')).toBeNull();
     });
 
     it('creates correct query params with `options.client_id` defined', async () => {
       const auth0 = setup();
 
-      const url = auth0.buildLogoutUrl({ client_id: 'another-client-id' });
+      const url = auth0.buildLogoutUrl({ clientId: 'another-client-id' });
 
       assertUrlEquals(url, TEST_DOMAIN, '/v2/logout', {
         client_id: 'another-client-id'
@@ -102,7 +102,7 @@ describe('Auth0Client', () => {
 
       const url = auth0.buildLogoutUrl({
         returnTo: 'https://return.to',
-        client_id: null
+        clientId: null
       });
 
       assertUrlEquals(url, TEST_DOMAIN, '/v2/logout', {
@@ -113,7 +113,7 @@ describe('Auth0Client', () => {
     it('creates correct query params when `options.federated` is true', async () => {
       const auth0 = setup();
 
-      const url = auth0.buildLogoutUrl({ federated: true, client_id: null });
+      const url = auth0.buildLogoutUrl({ federated: true, clientId: null });
 
       assertUrlEquals(url, TEST_DOMAIN, '/v2/logout', {
         federated: ''
diff --git a/__tests__/Auth0Client/constructor.test.ts b/__tests__/Auth0Client/constructor.test.ts
index 735fc2d..7d81627 100644
--- a/__tests__/Auth0Client/constructor.test.ts
+++ b/__tests__/Auth0Client/constructor.test.ts
@@ -182,14 +182,14 @@ describe('Auth0Client', () => {
     it('creates correct query params with `options.client_id` is null', async () => {
       const auth0 = setup();
 
-      const url = new URL(auth0.buildLogoutUrl({ client_id: null }));
+      const url = new URL(auth0.buildLogoutUrl({ clientId: null }));
       expect(url.searchParams.get('client_id')).toBeNull();
     });
 
     it('creates correct query params with `options.client_id` defined', async () => {
       const auth0 = setup();
 
-      const url = auth0.buildLogoutUrl({ client_id: 'another-client-id' });
+      const url = auth0.buildLogoutUrl({ clientId: 'another-client-id' });
 
       assertUrlEquals(url, TEST_DOMAIN, '/v2/logout', {
         client_id: 'another-client-id'
@@ -201,7 +201,7 @@ describe('Auth0Client', () => {
 
       const url = auth0.buildLogoutUrl({
         returnTo: 'https://return.to',
-        client_id: null
+        clientId: null
       });
 
       assertUrlEquals(url, TEST_DOMAIN, '/v2/logout', {
@@ -212,7 +212,7 @@ describe('Auth0Client', () => {
     it('creates correct query params when `options.federated` is true', async () => {
       const auth0 = setup();
 
-      const url = auth0.buildLogoutUrl({ federated: true, client_id: null });
+      const url = auth0.buildLogoutUrl({ federated: true, clientId: null });
 
       assertUrlEquals(url, TEST_DOMAIN, '/v2/logout', {
         federated: ''
diff --git a/__tests__/Auth0Client/helpers.ts b/__tests__/Auth0Client/helpers.ts
index ea584e8..669240e 100644
--- a/__tests__/Auth0Client/helpers.ts
+++ b/__tests__/Auth0Client/helpers.ts
@@ -110,7 +110,7 @@ export const setupFn = (mockVerify: jest.Mock) => {
       Object.assign(
         {
           domain: TEST_DOMAIN,
-          client_id: TEST_CLIENT_ID,
+          clientId: TEST_CLIENT_ID,
           redirect_uri: TEST_REDIRECT_URI
         },
         config
diff --git a/__tests__/cache/cache-manager.test.ts b/__tests__/cache/cache-manager.test.ts
index fb1f0a7..f82d24c 100644
--- a/__tests__/cache/cache-manager.test.ts
+++ b/__tests__/cache/cache-manager.test.ts
@@ -27,7 +27,7 @@ import { InMemoryAsyncCacheNoKeys } from './shared';
 import { expect } from '@jest/globals';
 
 const defaultKey = new CacheKey({
-  client_id: TEST_CLIENT_ID,
+  clientId: TEST_CLIENT_ID,
   audience: TEST_AUDIENCE,
   scope: TEST_SCOPES
 });
@@ -110,7 +110,7 @@ cacheFactories.forEach(cacheFactory => {
       await manager.set(data);
 
       const key = new CacheKey({
-        client_id: TEST_CLIENT_ID,
+        clientId: TEST_CLIENT_ID,
         audience: TEST_AUDIENCE,
         scope: 'read:messages'
       });
@@ -127,7 +127,7 @@ cacheFactories.forEach(cacheFactory => {
       await manager.set(data);
 
       const key = new CacheKey({
-        client_id: TEST_CLIENT_ID,
+        clientId: TEST_CLIENT_ID,
         audience: TEST_AUDIENCE,
         scope: 'read:messages write:messages'
       });
@@ -149,7 +149,7 @@ cacheFactories.forEach(cacheFactory => {
 
       expect(
         await manager.get(
-          new CacheKey({ client_id: 'test', audience: 'test', scope: 'test' })
+          new CacheKey({ clientId: 'test', audience: 'test', scope: 'test' })
         )
       ).not.toBeDefined();
 
@@ -182,7 +182,7 @@ cacheFactories.forEach(cacheFactory => {
       await manager.set(data);
 
       const key = new CacheKey({
-        client_id: TEST_CLIENT_ID,
+        clientId: TEST_CLIENT_ID,
         audience: TEST_AUDIENCE,
         scope: 'read:messages read:actions'
       });
@@ -201,7 +201,7 @@ cacheFactories.forEach(cacheFactory => {
       expect(
         await manager.get(
           new CacheKey({
-            client_id: TEST_CLIENT_ID,
+            clientId: TEST_CLIENT_ID,
             audience: TEST_AUDIENCE,
             scope: TEST_SCOPES
           }),
diff --git a/__tests__/cache/cache.test.ts b/__tests__/cache/cache.test.ts
index e8afab1..f6c43fe 100644
--- a/__tests__/cache/cache.test.ts
+++ b/__tests__/cache/cache.test.ts
@@ -90,7 +90,7 @@ cacheFactories.forEach(cacheFactory => {
       };
 
       const cacheKey = new CacheKey({
-        client_id: TEST_CLIENT_ID,
+        clientId: TEST_CLIENT_ID,
         audience: TEST_AUDIENCE,
         scope: 'the_scope'
       });
@@ -114,7 +114,7 @@ cacheFactories.forEach(cacheFactory => {
       };
 
       const cacheKey = new CacheKey({
-        client_id: TEST_CLIENT_ID,
+        clientId: TEST_CLIENT_ID,
         audience: TEST_AUDIENCE,
         scope: 'the_scope3 the_scope'
       });
@@ -150,7 +150,7 @@ cacheFactories.forEach(cacheFactory => {
       expect(
         await cache.get(
           new CacheKey({
-            client_id: TEST_CLIENT_ID,
+            clientId: TEST_CLIENT_ID,
             audience: TEST_AUDIENCE,
             scope: 'the_scope4 the_scope'
           }).toKey()
diff --git a/__tests__/cache/key-manifest.test.ts b/__tests__/cache/key-manifest.test.ts
index d0d52f8..21c9574 100644
--- a/__tests__/cache/key-manifest.test.ts
+++ b/__tests__/cache/key-manifest.test.ts
@@ -19,7 +19,7 @@ describe('CacheKeyManifest', () => {
 
   it('should create a new item in the manifest if one does not exist', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
@@ -34,7 +34,7 @@ describe('CacheKeyManifest', () => {
 
   it('should add another key to the same list if an entry already exists in the manifest', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
@@ -42,7 +42,7 @@ describe('CacheKeyManifest', () => {
     await manifest.add(key.toKey());
 
     const key2 = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: 'http://another-audience',
       scope: TEST_SCOPES
     });
@@ -57,7 +57,7 @@ describe('CacheKeyManifest', () => {
 
   it('should not add the same key twice', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
@@ -65,7 +65,7 @@ describe('CacheKeyManifest', () => {
     await manifest.add(key.toKey());
 
     const key2 = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: 'http://another-audience',
       scope: TEST_SCOPES
     });
@@ -82,7 +82,7 @@ describe('CacheKeyManifest', () => {
 
   it('can remove an entry', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
@@ -94,7 +94,7 @@ describe('CacheKeyManifest', () => {
 
   it('does nothing if trying to remove an item that does not exist', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
@@ -104,13 +104,13 @@ describe('CacheKeyManifest', () => {
 
   it('can remove a key from an entry and leave others intact', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
 
     const key2 = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: 'http://another-audience',
       scope: TEST_SCOPES
     });
@@ -123,13 +123,13 @@ describe('CacheKeyManifest', () => {
 
   it('does not remove the whole entry if the key was not found', async () => {
     const key = new CacheKey({
-      client_id: TEST_CLIENT_ID,
+      clientId: TEST_CLIENT_ID,
       audience: TEST_AUDIENCE,
       scope: TEST_SCOPES
     });
 
     const randomKey = new CacheKey({
-      client_id: key.client_id,
+      clientId: key.clientId,
       audience: 'http://some-other-audience',
       scope: key.scope
     });
diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts
index 9821af5..81aefc2 100644
--- a/__tests__/index.test.ts
+++ b/__tests__/index.test.ts
@@ -88,7 +88,7 @@ const setup = async (
   const auth0 = callConstructor
     ? await createAuth0Client({
         domain: TEST_DOMAIN,
-        client_id: TEST_CLIENT_ID,
+        clientId: TEST_CLIENT_ID,
         ...clientOptions
       })
     : undefined;
@@ -152,7 +152,7 @@ describe('Auth0', () => {
     it('should create an Auth0 client', async () => {
       const auth0 = await createAuth0Client({
         domain: TEST_DOMAIN,
-        client_id: TEST_CLIENT_ID
+        clientId: TEST_CLIENT_ID
       });
 
       expect(auth0).toBeInstanceOf(Auth0Client);
@@ -168,7 +168,7 @@ describe('Auth0', () => {
       await expect(
         createAuth0Client({
           domain: TEST_DOMAIN,
-          client_id: TEST_CLIENT_ID,
+          clientId: TEST_CLIENT_ID,
           cacheLocation: 'dummy'
         } as any)
       ).rejects.toThrow(new Error('Invalid cache location "dummy"'));
@@ -188,7 +188,7 @@ describe('Auth0', () => {
 
       const auth0 = await createAuth0Client({
         domain: TEST_DOMAIN,
-        client_id: TEST_CLIENT_ID
+        clientId: TEST_CLIENT_ID
       });
 
       expect(auth0).toBeInstanceOf(Auth0Client);
@@ -210,7 +210,7 @@ describe('Auth0', () => {
         utils.runIframe.mockRejectedValue({ error });
         const auth0 = await createAuth0Client({
           domain: TEST_DOMAIN,
-          client_id: TEST_CLIENT_ID
+          clientId: TEST_CLIENT_ID
         });
         expect(auth0).toBeInstanceOf(Auth0Client);
         expect(utils.runIframe).toHaveBeenCalledTimes(1);
@@ -227,7 +227,7 @@ describe('Auth0', () => {
 
       const auth0 = await createAuth0Client({
         domain: TEST_DOMAIN,
-        client_id: TEST_CLIENT_ID
+        clientId: TEST_CLIENT_ID
       });
 
       expect(cookieStorage.get).toHaveBeenCalledWith(
@@ -246,7 +246,7 @@ describe('Auth0', () => {
 
       const auth0 = await createAuth0Client({
         domain: TEST_DOMAIN,
-        client_id: TEST_CLIENT_ID
+        clientId: TEST_CLIENT_ID
       });
 
       expect(auth0.getTokenSilently).toHaveBeenCalledWith(undefined);
@@ -267,7 +267,7 @@ describe('Auth0', () => {
 
         const auth0 = await createAuth0Client({
           domain: TEST_DOMAIN,
-          client_id: TEST_CLIENT_ID,
+          clientId: TEST_CLIENT_ID,
           ...options
         });
 
@@ -291,7 +291,7 @@ describe('Auth0', () => {
 
         const auth0 = await createAuth0Client({
           domain: TEST_DOMAIN,
-          client_id: TEST_CLIENT_ID,
+          clientId: TEST_CLIENT_ID,
           ...options
         });
 
diff --git a/__tests__/jwt.test.ts b/__tests__/jwt.test.ts
index 49aec8f..da07c15 100644
--- a/__tests__/jwt.test.ts
+++ b/__tests__/jwt.test.ts
@@ -8,7 +8,7 @@ const verifyOptions = {
   iss: 'https://brucke.auth0.com/',
   aud: 'k5u3o2fiAA8XweXEEX604KCwCjzjtMU6',
   nonce: 'omcw.ptjx3~.8VBm3OuMziLdn5PB0uXG',
-  client_id: 'the_client_id'
+  clientId: 'the_client_id'
 };
 
 const createPrivateKey = () => {
diff --git a/__tests__/ssr.test.ts b/__tests__/ssr.test.ts
index ebceb8a..9ca0c0a 100644
--- a/__tests__/ssr.test.ts
+++ b/__tests__/ssr.test.ts
@@ -7,12 +7,12 @@ import { expect } from '@jest/globals';
 describe('In a Node SSR environment', () => {
   it('can be constructed', () => {
     expect(
-      () => new Auth0Client({ client_id: 'foo', domain: 'bar' })
+      () => new Auth0Client({ clientId: 'foo', domain: 'bar' })
     ).not.toThrow();
   });
 
   it('can check authenticated state', async () => {
-    const client = new Auth0Client({ client_id: 'foo', domain: 'bar' });
+    const client = new Auth0Client({ clientId: 'foo', domain: 'bar' });
     expect(await client.isAuthenticated()).toBeFalsy();
     expect(await client.getUser()).toBeUndefined();
   });