Apple Sign In - Double prompt issue

Hi,

we have PWA for which we´ve built a wrapper using PWA Builder tool and we are experiencing an issue with apple sign in.

When we try to redirect the user to "https://appleid.apple.com/auth/authorize?...params...", a bottom sheet login prompt appears and only once the user signs in using the prompt he is then redirected to the url where he needs to sign in again and then we get the callback. We want to get rid of that bottom sheet prompt.

The code we´ve tried:

  ` iosButton.addEventListener('click', function () {
      window.location.href = "https://appleid.apple.com/auth/authorize?client_id=xxxxx&redirect_uri=xxxxx&response_type=code%20id_token&scope=name%20email&response_mode=form_post";
    });`

The alternative code we´ve tried for which it seems that nothing happens, we only see the "Started" alert, we´ve confirmed that there is no other error :

`  <script src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>

    <script>
(function initAppleSignIn() {
            try {
                window.AppleID.auth.init({
                    clientId: "{{ env('APPLE_WEB_CLIENT_ID') }}", 
                    scope: "name email",
                    redirectURI: window.location.origin +"/auth/apple/callback",     
                    usePopup: true    
                });
            } catch (e) {
                console.warn('Apple Sign-In init skipped:', e);
            }
})();


function appleButtonClicked() {

 alert("Started");
   try {
     const res = await window.AppleID.auth.signIn();
   }  catch (err) {
     alert("Got error");
   }
    alert("Got here");

}



    </script>


Apple Sign In - Double prompt issue
 
 
Q