Need help with auth flow using Sign In with Apple

SDK: 35.0.0
Platform: iOS

Hi, everyone.

Before trying to add Sign In With Apple, I had a simple email/password form that a user fills in. It’s sent to the back end, the password is hashed, a user is created, and a token is sent back. This token is then put in an authorization header. This is the basic auth flow recommended in the Apollo Client docs.

To log in later, the sent password is checked against the hash and if it’s good, they get the token back. Standard stuff. With Sign In With Apple , however, I’m not exactly sure how to handle things. I have it working so I can get the credentials back once you try to sign in and then I know I can create a user object to send to the back end but I’m not sure how I handle password here.

This is what comes back when trying to register using Sign in with Apple:

{
  authorizationCode: "...",
  email: "...",
  fullName: {
  familyName: "...",
  givenName: "...",
  middleName: null,
  namePrefix: null,
  nameSuffix: null,
  nickname: null,
  },
  identityToken: "...",
  realUserStatus: 1,
  state: null,
  user: "...",
}

I can then create a new user object to send to the back end, like this. All the back end needs for creating a user is a valid email, a name, and a password so this is good.

{
  name: credential.fullName.givenName,
  email: credential.email,
  password: "..."
}

I’m not sure exactly, however, how I should be doing things at this point? That is, sending a password to the back end vs. doing something a token returned from the sign in. I’m new to Expo and have never played with social logins before so all of this is new to me.

Any advice would be greatly appreciated. Thank you!

Ah, is the answer to create a different sign up endpoint – one that doesn’t require a password – and then create a user with a token for Sign in with Apple?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.