Upgrading from auth0-lock v11.0.1 to v12.0.2 for angularjs breaks authentication

I’m looking for some help with an angularjs 1.x application I’m new to auth0 I was tasked with upgrading from 11.0.1 to v12.0.2, but upon upgrading our resumeAuth method breaks and will only pass null for both error and authResult to the callback function.

The code to instantiate our v11 authlock object looks like this(with domains blurred using ###):

var options = {
        auth: {
            responseType: 'token',
            autoParseHash: true,
            params: {
                scope: 'openid'
            }
        },
        responseType: "id_token",
        allowSignUp: false,
        allowForgotPassword: true,
        sso: true,
        usernameStyle: 'username',
        hashCleanup: true,
        theme: {
            logo: '#########',
            primaryColor: '#009CDE'
        },
        languageDictionary: {
            title: 'Portal Management'
        }
      };


    
    var lock = new Auth0Lock.default(appConfig.auth0_lock_clientID, '##########', options);

After upgrading I have tried correcting the autoParseHash to false and fiddling with the response types (I inherited this code to upgrade so I cannot figure out why we have two responseType options). Here is what our authResult function looks like:

console.log("hash: " + $window.location.hash);
    lock.resumeAuth($window.location.hash, function(error, authResult) {
        console.log("auth resumed");
        debugger;
        if (error) {
            console.log(error.errorDescription);
            auth.valid = false;
        }   
        else if (authResult){
            console.log(authResult);
            appConfig.id_token = authResult.idToken;
            $window.sessionStorage.setItem("id_token", authResult.idToken);
             $http({
			    url: '/api/auth',
			    method: 'GET',
			    headers: {
			        'authorization': 'bearer ' + authResult.idToken,
			        'Content-Type': 'application/json'
			    }
			}).then(function success(res){
                appConfig.access_token = res.data.access_token; 
			    $window.sessionStorage.setItem('access_token', res.data.access_token);
			}, function error(res){
                console.log(res);
			    //Handle error getting token
                if (res.status == 400 || res.status == 401) {
			      auth.valid = false;
                  
                }
			}); 
        }
        else if ($window.sessionStorage.getItem("id_token") == null) {
            auth.valid = false;
            //$rootScope.$broadcast("openRedirect");

            // redirect to login.
            window.location = appConfig.login_url;
        }
    });
	return auth;

Currently the application will allow me to login and enter my MFA code, but as soon as I am directed to the front page I am redirected because I am unauthorized and my session storage does not contain id_token nor access_token. One interesting thing I have noted is that the console log displaying the hash seems to contain a valid authenticated hash similar to the one from v11, but resumeAuth seems to not agree with the formatting of it anymore. Also when changing some of the response types without closing my browser window I can get it to authenticate once if I change the options.Auth.responseType to id_token I can successfully login exactly one time before it starts throwing this error

Object { error: "invalid_hash", errorDescription: "response_type contains `token`, but the parsed hash does not contain an `access_token` property" }

Here is a example structure of the hash being returned after the v12 upgrade in the console log before resumeAuth hash:

 #!#id_token=...&state=...

However, changing the responseType to “id_token token” gives a hash with a structure like which is the same structure as the program returned in v11

#!#access_token=...&id_token=...&scope=openid&expires_in=86400&token_type=Bearer&state=

But then I start getting the invalid hash error when using this response type.

Any insight would be appreciated thanks!

Hello, did you get the solution? Please kindly share if you did :slightly_smiling_face: :pray: