jsforce / jsforce/jsforce

BrowserClient with outh2 config wields empty client_id and redirect_uri query parameters

Open
#1,617 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
551
Avg merge
9h 2m
Merged PRs (30d)
3

Description

Consider the following code:

const oauth2 = new jsforce.OAuth2({
      clientId: 'some-client-id',
      redirectUri: 'some-redirect-uri',
});
const client = new jsforce.BrowserClient();
client.init({
    oauth2: oauth2
} as any);
client.login();

This code opens a popup with:
Actual Authorization URL: https://login.salesforce.com/services/oauth2/authorize?response_type=code&state=jsforce10.popup.krxv9lgkg3n&client_id=&redirect_uri=
Expected Authorization URL: https://login.salesforce.com/services/oauth2/authorize?response_type=code&state=jsforce10.popup.krxv9lgkg3n&client_id=some-client-id&redirect_uri=some-redirect-uri

If I change the above code (note I need to force the config object to any since this does not match the types.

const client = new jsforce.BrowserClient();
client.init({
      clientId: 'some-client-id',
      redirectUri: 'some-redirect-uri',
} as any);
client.login();

Then, the expected URL is generated. But this is not matching the typescript types.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at BrowserClient.init and login, then trace how the supplied OAuth2 instance is read when building the authorization URL. Compare that path with the direct clientId and redirectUri configuration path; done means the typed OAuth2 configuration produces the expected non-empty parameters and accepts the shown TypeScript usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.