-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incomplete type definition for oauth2.requestToken() return value. #1366
Comments
Hi, I think you are referring to the types in these are community maintained so you can probably open a PR there but we don't maintain it. jsforce v2 (written in TS) has the suggested Lines 48 to 58 in b7ac34f
|
Ooh, I see. @cristiand391 Should I keep this issue open then ? |
let's leave it open in case anyone wants to fix it in |
Context
When working with a developer sandbox, the
instanceUrl
must be in the form of{yourSandbox}.sandbox.my.salesforce.com
instead of{yourSandbox}.sandbox.lightning.force.com
(otherwise, any API calls will result in an INVALID_SESSION_ID 401 error).To avoid this mistake, the
/oauth/token
endpoint returns the access token, but also theinstance_url
property.Issue
The
oauth2.requestToken()
's return type isTokenResponse
, an interface with the following properties :However, it differs to what Salesforce is really returning.
Possible fix
I suggest changing the TokenResponse definition type to this :
It's based on this help article (https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_web_server_flow.htm&type=5), but I couldn't find the real API reference.
Workaround
Create a custom type, and cast the return value to that type.
The text was updated successfully, but these errors were encountered: