durga durga
durga durga

Reputation: 1

I am not able to return back to my app once authentication was successful using ASWebAuthentication in ios platform

Implemented logic in ionic angular cordova application

 if (this.cordovaService.onCordova) {
      if (this.platform.is("ios")) {
        let callbackURLScheme = 'appURLScheme';(com.clientname.appname)
        try {
          //url contain microsoft login which include redirect uri(Added web app link) and also nounce.
          this.asWebAuthSession
            .start(encodeURIComponent(callbackURLScheme), url)
            .then((response) => {
              console.log("Authentication is successful", response);
              this.getAccessCodeFromURL(response);
            })
            .catch((error) => {
              console.error("Authentication failed", error);
              this.toast.error("Authentication failed");
            });
        } catch (error) {
          this.toast.error("Error initializing asWebAuthSession:");
        }
      }
    }

using below plugin

import { IosASWebauthenticationSession } from '@ionic-native/ios-aswebauthenticationsession-api/ngx';


Currently, i am using ionic 6, angular 12 versions

I want my application to redirect to main application once authentication is successful. Right now my app was stuck on browser and i am not able to get 'Authentication is successful' console statement as well and when i manually click on cancel i am getting authentication failed error.

I am probably not sure whether issue occurs because of any un-finished setup in client azure active directory or functional code like invalid callback url scheme ?

Any help is appreciated. Looking forward to here any solution.

Note: more-ever, As i don't have active SSO user to test the solutions. It will be more helpful to provide working solution.

Upvotes: 0

Views: 71

Answers (0)

Related Questions