Apple SSO popUp state not being returned

.Hey,


I'm working on implementing Apple SSO in my application using the `usePopup` option. However, the returned promise does not seem to contain the `state` parameter that I expect it to based on these docs https://developer.apple.com/documentation/signinwithapplejs/configuring_your_webpage_for_sign_in_with_apple.


My init looks like:


AppleID.auth.init({
  clientId: appleClientId,
  scope: 'name email',
  usePopup: true,
  redirectURI: "redirectUrl",
  state: JSON.stringify({
       param1: "someParam",
  }),
});

and on click I do

AppleID.auth.signIn().then((authData) => { console.log(authData); });


Based on the docs I expect the state to be in the authorization object, but...it's not.

Replies

I'm seeing the same thing you are. I would expect to see the state in the authorization key, and there should also be a user key at the same level as authorization according to the docs. The SignInResponseI interface also shows the same properties that are supposed to be included, but they are not in my response. I only have an authorization with code and id_token.


Am I doing something wrong?


Edit: The user key does appear, but only on the first attempt. Subsequent attempts, that key is not present. I had to go into my Apple account and delete the website from my list of Apps and Websites to see it again on the next try. Still, I don't see the state parameter, but I guess that can be manually included in my request to my server with the other info.