Continue with Apple - system-level logged out, problem

Hey. I am following basically the exact code demonstrated here https://developer.apple.com/documentation/authenticationservices/implementing_user_authentication_with_sign_in_with_apple


If the user is already logged in at a system-level, the whole thing work perfectly. The problem comes in when the user is not already apple-logged-in at the system-level.


Reproduction steps:
- setup a project and put in the code in the example link above- open a simulator, and make sure that in the Settings App, you are completely logged out of your apple account

--- this works on a real device too, but for quick testing purposes, without blowing up your device, you can use a simulator

- run your app

- tap your lil apple sign in button

- notice you get directed to settings app to login

- login to your apple account

- NOTICE: you are now stuck inside the Settings App

- NOTICE: even if you tap the 'back to your app' button in the status bar, you are still not logged in, inside your app

- NOTICE: you must initiate the apple sign in from the button a second time to get it working
This seems non-intuitive to me. I am a bit confused, and I feel like this is too much tapping for a user to actually use it, if they are already logged out on the system-level. Is there something I am missing here? Is there a way that I can accomplish the following:- user is logged out at system-level

- user opens my app

- user taps 'continue with apple' or whatever

- user is directed to Settings App to login

- **** once logged in, user is returned to my app and faced with the apple login bottom sheet


Is it possible to accomplish the **** step automatically, or with a parameter, or with a project setting, or some other thing? Even if this is not the exact path, is there a way to get a system-level-logged-out user to login and then apple-sign-in with a single button tap without having to do it twice?

Accepted Reply

Okay. After a little thought, I figured out a solution. These are the basic solution steps I came up with (hacky but working):
- user taps button

- code initiates authorization request

--- during this step i set a bool indicating that we started login

- i listen for lifecycle changes in the app

- when the app goes to 'paused' i:

1. check if we are currently in the process of apple sign in

2. if we are, i setup a callback to trigger on 'resume'

- when the user returns to the app, the code is triggered
- if the user 'canceled' then we do nothing
- if it looks like the user is just returning AND we still have true on the apple sign in attempt bool, then we automatically trigger sign in again
- we also cleanup the bool to not cause an infinite loop


Hope this helps someone else overcome this non-intuitive user experience.


Chris.

Replies

Okay. After a little thought, I figured out a solution. These are the basic solution steps I came up with (hacky but working):
- user taps button

- code initiates authorization request

--- during this step i set a bool indicating that we started login

- i listen for lifecycle changes in the app

- when the app goes to 'paused' i:

1. check if we are currently in the process of apple sign in

2. if we are, i setup a callback to trigger on 'resume'

- when the user returns to the app, the code is triggered
- if the user 'canceled' then we do nothing
- if it looks like the user is just returning AND we still have true on the apple sign in attempt bool, then we automatically trigger sign in again
- we also cleanup the bool to not cause an infinite loop


Hope this helps someone else overcome this non-intuitive user experience.


Chris.