Please, tell us how to recreate the issue in as much detail as possible.
Calling the method refreshTokenWithCompletion does not complete the promise if the variables this.provider.tokenEndpoint or this.tokenResult do not exist. This leaves the promise in limbo forever and leaving the user without feedback.
To reproduce it call refreshTokenWithCompletion without logging in.
Expected result -> I get an error that completes the Promise saying that either this.provider.tokenEndpoint or this.tokenResult do not exist.
Actual result -> The promise never completes
Is there any code involved?
Call from demo code
this.getClient().refreshTokenWithCompletion((tokenData: ITnsOAuthTokenResult, error) => {
if (error) {
console.error('back to main page with error: ');
console.error(error);
} else {
console.log('back to main page with access token: ');
}
});
Call within the plugin in file oauth.ts
// refreshTokenWithCompletion calls an internal function callRefreshEndpointWithCompletion
public refreshTokenWithCompletion(completion?: TnsOAuthClientLoginBlock) {
if (this.provider) {
this.callRefreshEndpointWithCompletion(completion);
} else {
completion(null, "Provider is not configured");
}
}
private callRefreshEndpointWithCompletion(
completion?: TnsOAuthClientLoginBlock
) {
if (!this.provider.tokenEndpoint) {
return; // Instead return an error using completion(null, error) to complete the Promise;
}
if (!this.tokenResult) {
return; // Instead return an error using completion(null, error) to complete the Promise;
}
...function continues
);
connection.startTokenRefresh();
}
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
--"@nativescript/android": "8.2.2" -- "@nativescript/ios": "8.2.3"
Please, tell us how to recreate the issue in as much detail as possible.
Calling the method refreshTokenWithCompletion does not complete the promise if the variables
this.provider.tokenEndpoint
orthis.tokenResult
do not exist. This leaves the promise in limbo forever and leaving the user without feedback.To reproduce it call refreshTokenWithCompletion without logging in.
Expected result -> I get an error that completes the Promise saying that either
this.provider.tokenEndpoint
orthis.tokenResult
do not exist.Actual result -> The promise never completes
Is there any code involved?
Call from demo code
Call within the plugin in file
oauth.ts