Skip to content

Fix for bug#259#260

Merged
Mathieu2301 merged 1 commit intoMathieu2301:mainfrom
narayanan-gokul:bug#259
Sep 22, 2024
Merged

Fix for bug#259#260
Mathieu2301 merged 1 commit intoMathieu2301:mainfrom
narayanan-gokul:bug#259

Conversation

@narayanan-gokul
Copy link
Contributor

@narayanan-gokul narayanan-gokul commented Sep 15, 2024

Fix for #259

Root cause

The client constructor relies on the getUser method of the miscRequests module, which requires location-specific URL to be passed as one of its arguments.

Added a property location to the clientOptions object passed to the client constructor. This location field will then be passed to the getUser method within the constructor.

**Root cause**

The client constructor relies on the `getUser` method of the
`miscRequests` module, which requires location-specific URL to be passed
as one of its arguments.

Added a property `location` to the `clientOptions` object passed to the
client constructor. This `location` field will then be passed to the
`getUser` method within the constructor.
@narayanan-gokul
Copy link
Contributor Author

Will it be possible to expedite the review for this PR? I have a project that is waiting on this fix, and it would be highly appreciated if the fix was made available as soon as possible. @Mathieu2301

@clins1994
Copy link
Collaborator

@narayanan-gokul thanks for the PR. can you share your requests and responses for both with the location option and without? kind of hard to approve without seeing some kind of testing

@narayanan-gokul
Copy link
Contributor Author

@clins1994 Definitely! My bad for not adding evidence sooner.

Here's a basic client initialization code:

const client = new Client({ token: sessionid, signature });

Using this code to create a client using valid session cookies for an account based in India throws the following error:

error-without-location

Adding the option to pass the location-specific URL changes the client code like so:

const client = new Client({ token: sessionid, signature, location: "https://in.tradingview.com" });

Which produces no error:

with-location

Please let me know in case you need anything else.

Copy link
Collaborator

@clins1994 clins1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clins1994
Copy link
Collaborator

@narayanan-gokul no worries. thank you for providing the info. looks good ✅

@narayanan-gokul
Copy link
Contributor Author

@clins1994 Thank you for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong or expired sessionid/signature error even for valid tokens during client initialization

3 participants