I follow the below link :
Ionic Framework: Getting Started …
- I install 0auth.
npm install auth0-js @auth0/cordova --save
- I added safariviewcontroller plugin.
ionic cordova plugin add cordova-plugin-safariviewcontroller
ionic cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME=io.ionic.starter --variable ANDROID_SCHEME=io.ionic.starter --variable ANDROID_HOST=http://{hostname}/demo-0.0.1-SNAPSHOT/oauth/authorize --variable ANDROID_PATHPREFIX=/cordova/io.ionic.starter/callback
-
I added below on line config.xml
<preference name="AndroidLaunchMode" value="singleTask" />
-
I added below code on
app/app.component.ts
(<any>window).handleOpenURL = (url) => {
Auth0Cordova.onRedirectUri(url);
this.authService.authenticationState.subscribe(state=>{
if (state) {
this.stateFlag = true;
this.router.navigate(['menu','projectcode']);
}else {
this.router.navigate(['login']);
this.stateFlag = false;
}
});
};
Then, I created ts file src/services/auth.service.ts
and follow the instruction as below link:
When I run the apps and login, now I encounter the issue of “Error in Success callbackId: SafariViewController76610951 : TypeError: crypto.randomBytes is not a function”…