I'm using ASWebAuthenticationSession for OAuth and all works well when I can use my custom scheme. However, when I try it with a service that requires a protocol in the redirect url "https://myapp.com/auth", I just see "cannot find server..." after I do the authorization steps.
Asked
Active
Viewed 2,972 times
1 Answers
0
You have to use your private scheme instead of https
which is handled by Safari.
- Set your project to handle your scheme:
com.my.app
(for example) - Init session for you scheme:
let session = ASWebAuthenticationSession(url: url, callbackURLScheme: "com.my.app://", completionHandler: completion)
Further readings:

Community
- 1
- 1

Max Potapov
- 1,267
- 11
- 17
-
Thank you, but I tried that. The OAuth server responds with "invalid url" – CogitoErgoBibo Oct 04 '19 at 13:16
-
Do you have an access to setting for your application on oauth server? You need to change redirect uri if possible. If no, ask technical support to allow native application schemes and send them RFC8252. – Max Potapov Oct 05 '19 at 08:11
-
I do have access. I set the URI to match. I access another server and my app has no problem with that one. – CogitoErgoBibo Oct 08 '19 at 14:01
-
The server accepts "myapp.com" as the URI, but if I don't include "https://" when I request the auth code, it responds with an invalid URI. If I include it, Safari says it can't find the server. The service I'm trying to connect to is Ecobee... this shouldn't be this difficult. – CogitoErgoBibo Oct 08 '19 at 14:03
-
How do you init step 2 in obj-c? – Sergio Solorzano Jun 15 '21 at 15:18
-
@CogitoErgoBibo have you solved the problem? I'm experiencing a similar problem with Amazon Alexa. – mrAlmond Mar 03 '22 at 17:08