Worst decision ever: Both Google and Facebook make no distinction between the SIGN-IN and SIGN-UP, but Apple YES.
In this case, instead of handling both situations in one shot (LIKE WE DO WITH ALL OTHER SERVICES), we have to distinguish both cases:
SIGNUP (Praying that everything will work in your backend because in case of db connection errors you are lost):
Take from ajax POST request the fields: name,email,token_id -> Validate token_id using apple api, check if the user already exists on db and if not exist insert and generate your app token, if exist just create and pass your app token.
SIGNIN (Praying that signup has been completed without errors):
Take from ajax POST request the only available field token_id -> Validate token_id using apple api and check if the user already exist. If not exist return error, if exist generate and return your app token
Topic:
App & System Services
SubTopic:
General
Tags: