Open eduardocalixtokorp opened 3 years ago
Still no fix? @eduardocalixtokorp
I'll check it soon in 3.0.6 version (currently using 3.0.5). I was able to make it work by doing a workaround, which uses nativescript-urlhandler
package and manually calls resumeWithUrl
method.
I am also facing the same issue. plugin overriding the applicationOpenURLSourceApplicationAnnotation method. I have changed manually but still its not redirected back to authenticate page
applicationOpenURLSourceApplicationAnnotation(app: UIApplication, url: NSURL, sourceApp: string, annotation: any): boolean {
if (url.scheme.toLowerCase() === scheme) {
let client:TnsOAuthClient = new TnsOAuthClient('identityServer');
client.resumeWithUrl(url.absoluteString);
return true;
} else {
this.handleRouting(url);
}
}
@eduardocalixtokorp Could you please provide the workaround?
It's something like this:
import { AppURL, handleOpenURL } from 'nativescript-urlhandler';
// ...
var iosOauthRedirectFn: (url: string) => void;
handleOpenURL((appURL: AppURL) => {
if (isIOS && iosOauthRedirectFn) {
iosOauthRedirectFn(appURL.toString());
}
});
// ...
iosOauthRedirectFn = ((url) => {
if (this.oauthClient?.resumeWithUrl) {
this.oauthClient.resumeWithUrl(url);
}
});
this.oauthClient.loginWithCompletion(completion);
Notice that you should follow nativescript url handler guide
Thanks @eduardocalixtokorp. It works! Life saver :)
I wasn't able to get nativescript-urlhandler working on NativeScript 8. Is there another work around for this?
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
Please, tell us how to recreate the issue in as much detail as possible.
Only Sign in using iOS After the login process is finished, the oauth server returns to
<REDIRECT>://auth
, but nativescript-oauth2 doesn't recognize the returned value. This way app keeps in the login page (from oauth server).PS: completion never calls it back, but IOS app selection pop-up is showed. PS 2: I was able to identify the problem using nativescript-urlhandler package, with the same config it was able to return the returned url, containing all needed query params such as code
Is there any code involved?
loginWithCompletion call
Info.plist