Skip to content

Commit 5816b72

Browse files
committed
fix: Cannot set the client ID more than once
1 parent d8b60be commit 5816b72

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

examples/demo-app/src/cloud-providers/carto/carto-provider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ export default class CartoProvider extends Provider {
3333
this._folderLink = `https://{user}.${DOMAIN}/dashboard/maps/external`;
3434

3535
// Initialize CARTO API
36+
// NOTE: `clientID` is intentionally omitted from the constructor options.
37+
// OAuthApp's constructor calls `initOauth` (which sets `this._oauth`) only when
38+
// `oauthOptions.clientID` is truthy. `setClientID` below throws
39+
// 'Cannot set the client ID more than once' if `_oauth` is already set, so the
40+
// client ID must be passed via `setClientID` only — not via the constructor.
3641
this._carto = new OAuthApp(
3742
{
3843
authorization: `https://${DOMAIN}/oauth2`,
39-
clientID: clientId,
4044
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4145
scopes: 'schemas:c datasets:rw:*' as any
4246
} as any,

0 commit comments

Comments
 (0)