I am trying to use ionic capacitor browser plugin for oauth flow but the browser return an empty object instead of the expected token or code string from the auth server.
I have tried using a custom urlscheme. The expected result is that the plugin should return an object url which should contain the 'code' but nothing is returned
async openPage(){
App.addListener('appUrlOpen', (data) => {
console.log('Data: '+JSON.stringify(data));
})
await Browser.open({url: myUrl})
this.addRedirectListener();
}
private async addRedirectListener() {
App.addListener('appUrlOpen', async (data: any) => {
console.debug('AppComponent - constructor - appUrlOpen');
if(data.url.indexOf('callback#')!=-1) {
let regEx = /(callback#access_token=)(.*)/g;
let code = regEx.exec(data.url)[2];
console.log(code);
}
await Browser.close();
});
}
Return an empty object instead of the expected object which should have been a token or code string. I have tried using the app plugin to track an event when the redirect uri is triggered.
I expect to return an object with token or code string but returns an empty object