Unable to set 'refresh_token' value
- [x] Are you running the latest version?
- [x] Have you included sample input, output, error, and expected output?
- [x] Have you checked if you are using correct configuration?
Describe the bug This might be me doing this incorrectly, however I could not see a way of setting the value of the 'refresh_token' anywhere, so when the token expired, I had no way of requesting a new one.
In the readme file its says we need "Keep in mind that you need the 'refresh_token' value set.", but gives no example or explanation
Then discovered I could set this as an object below and pass that to eBay.OAuth2.setCredentials() which works, but is causing a ts error as setCredentials(authToken: AuthToken | string): void; is expecting a string and I cannot see another way of setting the value of refresh_token
Code
const authToken = {
access_token: token,
refresh_token: refresh_token,
};
eBay.OAuth2.setCredentials(authToken as any);
So either I'm working around the issue by sending an object to setCredentials() and breaking the ts, have missed a way of setting the value of 'refresh_token' by other means or setCredentials() needs to allow a second param or an object to set the value of 'refresh_token' I think?
Output
expected data
Would you like to work on this issue?
- [ ] Yes
- [x] No
- [ ] Maybe
@moggiex Thank you for raising this issue,
What you showed is the correct way to set the access token and refresh token. setCredentials() also accepts AuthToken-Type:
setCredentials({
refresh_token: refresh_token,
expires_in: 7200,
refresh_token_expires_in: 47304000,
token_type: 'User Access Token',
access_token: token
});
That should avoid the TS errors.
However, I see we need some type improvements here. expires_in, token_type and refresh_token_expires_in can be optional. This fields are not used (yet?).
mintUserAccessToken() should return a correct Type. I'll work on this. Thank you!
@moggiex Do you solve your issue?