Handle OAuth2 Authentication w/ SFSafariViewController


Am currently building an app which requires user authentication with OAuth2. The service am trying to log in is Todoist.

I’ve already done all the necessary setup (showing the login page in a SFSafariVC, defining the app scheme and so on).

The problem is I want to come back to my app after being logged in, but the SafariVC redirect to the OAuth redirect URL which is normal. You’ll say to me to put my custom app scheme in the Todoist Redirect URL but they don’t accept custom urls like app scheme, so I have to enter a valid URL in the Redirect URL field in Todoist.

So my question is how can I come back to my app after being logged in.

Thank you in advance.

PS: I don’t want to use any library for that.