Ionic Auth0 unable to login again after logging out

I’m able to login and logout on an Ionic 4 app on devices - android and ios.
The redirects work fine, so redirectUrl, callback url, CORS settings on app and Auth0 platform should be fine.

To logout, I hit the logout endpoint at Auth0.

         const url = https://${AUTH_CONFIG.domain}/v2/logout?client_id=${
            AUTH_CONFIG.clientId
          }&returnTo=${AUTH_CONFIG.packageIdentifier}://${
            AUTH_CONFIG.domain
          }/cordova/${AUTH_CONFIG.packageIdentifier}/callback;

This works fine based on the logs in Auth0. But the subsequent requests to login fails when authorize call is made.

I’m using Auth0Cordova for logging in and auth0-js to get profile.

Client = new Auth0Cordova(AUTH_CONFIG); …
this.Client.authorize(options, async (err, authResult) => {
if (err) {
–>Gets here… alerting.

See these logs from Auth0.
55%20pm

The second login does not create the authroization token.

This is the issue. The solution does not work. I can’t login the second time in either ios or android device.

Hey there!

Not an Ionic guy myself, but let me do some research and get back to you!

1 Like

Would be awesome if there was a sample app like for other frameworks that worked. The ionic3 sample also does not work. There is another app by a guest blogger for Auth0 that is useless in that it is purely Angular based. That works perfectly on a browser but that are no configurations for ios and android.

I have an Angular app in production that uses Auth0’s service. That works perfectly.

The issue initially was in being able to redirect correctly for ios. That works for first login. Why would it not authorize the second time? There is nothing in the error that is descriptive enough to try something. The log also tells me login was successful, but that “Success Exchange” does not happen.