Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popup is not getting closed on its own and onSuccess is not triggering. #84

Open
dev-mohsinm opened this issue Jan 22, 2025 · 1 comment

Comments

@dev-mohsinm
Copy link

This is my code

            <AppleSignIn
              authOptions={{
              clientId: cliendId,
              scope:"name email",
              redirectURI: "https://dc0d-119-63-128-55.ngrok-free.app/verify-apple/callback",
              state: "state",
              nonce: "nonce",
              usePopup: true
              }}
              onSuccess={(response) => handleAppleSuccess(response)}
              render={(renderProps) => (  
                <WhiteStoreButton
                  imgSrc={AppleLogo}
                  largeText="Apple"
                  handleClick={renderProps.onClick}
                  loading={appleVerifyLoading}
                />
              )}
            />

The main issue is that when usePopup gets open, it send an authorize request, which is successful but then the popup remains there. It doesn't close automatically and the onSuccess never gets trigger and I don't even receive anything on redirectURI (which is my backend's URL). I am using NestJs for backend and ReactJs for frontend.
If I set the usePopup as false, then I receive the request on my backend's api (redirect uri)

@dev-mohsinm dev-mohsinm changed the title Popup is not getting closed on its own. Popup is not getting closed on its own and onSuccess is not triggering. Jan 22, 2025
@mzanki
Copy link

mzanki commented Jan 27, 2025

If you are using a backend to complete the login flow, usePopup: true will not work since it attaches "response_mode" as "web_message", the redirectUri will not be performed.
In my backend I am managing the redirectUri that apples POST to my server when the response mode is set to "form_post".
Basically that code you have will not work.
Maybe you can get an idea to the linked repo: https://github.com/A-Tokyo/apple-signin-auth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants