apple-sign-in icon indicating copy to clipboard operation
apple-sign-in copied to clipboard

TypeError: undefined is not an object (evaluating 'r.name.firstName')

Open SylvainBigonneau opened this issue 3 years ago • 0 comments

Describe the bug I have started getting the given error in my production telemetry when using SignInWithApple.authorize on iOS:

TypeError: undefined is not an object (evaluating 'r.name.firstName')

It seems to be related to this line, which seems to expect name to always be an object, and apparently it doesn't!

Maybe this is due to changes on Apple's side?

To Reproduce

SignInWithApple.authorize({
        clientId: this.appleClientId,
        redirectURI: `${process.env.BASE_URL}/signin`,
        scopes: "email",
        state: "12345",
        nonce: "nonce",
})

Expected behavior Should probably have a little guard for name to be possibly undefined, such as:

givenName: res.user?.name?.firstName,

Smartphone (please complete the following information):

  • OS: iOS
  • Browser: Mobile Safari
  • Version: v1.0.1

SylvainBigonneau avatar Feb 13 '22 01:02 SylvainBigonneau