Safari error on login Microsoft account with oauth2 - microsoft-graph-api

I have a a problem on a Nativescript 5.1.0 project with Angular 4, I use the API nativescript-oauth2, and it works fine for Facebook and Google, but when I try to Login into Microsoft it does not do very well.
I can enter the e-mail account and password, even the permission screen is shown, but in this one when I press YES it crashes.
The problem is because of the property redirect uri (urn:ietf:wg:oauth:2.0:oob) for the Microsoft configuration, when Safari receives the redirect uri, Safari crashes.
I read that can be solved with a delegate, but it already exists in the nativescript-oauth2.
And the android browser does not show the error but it does nothing.
Help me please!!

With Microsoft oAuth, it tries to open your app with an URL scheme. You might want to setup URL schemes in your app like it's showcased in demo app for Provider, iOS & Android

Related

Safari cannot open the page because the address is invalid after successful uber oauth

I'm linking to the uber api authentication endpoints (/authorize and /token) via iOS and after a successful login, it returns "Safari cannot open the page because the address is invalid". I've narrowed this down to an iOS specific problem because the same react-native configuration works for Android.
I've tried a number of solutions.
Clear safari browsing history, web data, iPhone update, etc. Nothing has worked.
I believe URL Schemes under URL Types in info.plist has a pay here, but I'm struggling to wrap my head around what I need to put there.
Any thoughts?
Upon successful authentication, uber should return an access token for the user.

The redirect_uri URL must be absolute error for deep linking URI fbAPP_ID://

Everything was working fine until today I've tried to test Safari Facebook login mechanism on my app and I started getting the following error on web browser:
The redirect_uri URL must be absolute.
I'm not using the Facebook SDK (for various reasons outside the question's context, so don't ask why) and I'm trying to open the following URL manually:
https://www.facebook.com/dialog/oauth?client_id=MY_APP_ID&response_type=token,granted_scopes&redirect_uri=fbMY_APP_ID://&scope=user_friends,user_birthday,email,user_photos&default_audience=friends&sdk=ios
Everything was working fine, until today where I realized that the URL isn't executing properly. I didn't change any app settings or anything. How can I complete my login flow? Yes, I need to redirect back to fbAPP_ID:// to launch my app back when using iOS versions lower than 9.0 where native Safari isn't supported. Or is there any known way of redirecting back to the application pre-iOS 9 from external Safari? (other than me redirecting to website, then on my website, redirecting back to my app by force opening fbAPP_ID:// from Javascript)
The only "redirect_uri" that works out of the box is fbAPP_ID://authorize , this is the one used by the Facebook SDK and anyone can use it as well.

Oauth suddenly not working on iphone (with FS app installed only)

Our iphone app allows for sign in via Foursquare via oauth. It was working fine and recently stopped working.
The error we get is: Connecting Failure: Callback uri is not valid for this consumer.
HOWEVER, if the user does not have the foursquare app installed on their phone it works fine as before. It seems as if FS is now doing a redirect to handle the oauth inside the FS app and this fails when attempting to return to the originating application. Via safari it seems to work.
This is on ios 9.
Solutions?? Thanks!
We've changed to use a SafariViewController and this seems to force Foursquare to not to this strange in-app redirect, solving the issue. This is also Apple's preferred oauth method, so probably the way to go.
Still seems like a problem on the Foursquare side that they may want to address for others however. I'm closing this question. Thanks.
Where does your redirect URL point? If you want it to launch your app after completion you should point to the iTunes store (pre-iOS9) link for your app or the universal link (iOS9 onwards).
More information on redirects for the native foursquare app is available in the README here: https://github.com/foursquare/foursquare-ios-oauth/
How to create a universal link in iOS9 https://www.appsflyer.com/blog/how-to-set-up-ios-9-universal-links-for-your-app/
A callback url is a webpage loaded after your web app has been
verified. In this case, you need to specify a page for to send data to
after authentication
Double check your Foursquare credentials and update the callback uri to a valid link. Tutorial link
Please follow the below points, may be one resolves your issue:-
Enter the callback in foursquare account in addcallback methods. Then in your code add the call back to the provider before you authorize. (Reference here).
You're getting that error because the URL you're pointing your users to (foursquare.com/oauth2/...) includes a redirect_uri parameter that doesn't match with what you configured in your app's settings under https://foursquare.com/developers/apps. Make sure these match!

Instagram redirect URI doesn't match or some time safari says "Cannot open because invalid address" + iOS native app

I'm using this iOS Library https://github.com/crino/instagram-ios-sdk to login to instagram from my native app for sharing and getting feed from Instagram APIs. When i brought classes from this demo app to my project, here it is what happens:
Application successfully opens Authorization URL in safari and when i enter my credentials & authorize, it says "Safari cannot open address because its invalid" before redirecting to app or some time says "Redirect URI does not match registered URI".
Any help on this is appreciated.
You have to add URL scheme to your application's plist file, it's mentioned in short guide on github instragram page:
Make sure you've edited your application's .plist file properly, so that your applicaition binds to the ig[clientId]:// URL scheme (where [clientId] is your Instagram application CLIENT ID).
Here you'll find more information, see this article on TutsPlus: iOS SDK Working With URL Schemes
That error indicates that the URI you gave it is not handled by anything in the phone.
For example - the skype uri looks like skype:
IF skype is installed, it opens skype.
If skype is NOT installed, you get that same error.
You are either using the wrong URI (probably because you got the client-id wrong - do not include the [] in it), or, you do not have the Instagram app installed on your iOS device, or possibly you've messed with your instagram account and the app is not listening to that URI anymore.

Authentication using Facebook iOS SDK with Safari throws API Error code: 100

Testing my app on the Simulator requires Facebook authentication.
Since Facebook app is not installed on the simulator, Facebook uses Safari for authentication.
Apparently something changed in Facebook Authentication flow, which causes to users who already authenticated my app in the past to be redirected to an error page saying:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: Requires valid redirect URI.
Everything worked fine before.
Temporary Solution:
Apparently it happens in Android as well, it has to do with the new Facebook authentication dialog.
As explained here: Facebook Android sdk throwing missing redirect uri on Authetication
Go to your Facebook app settings page --> Advanced page --> Migrations --> Disable "Enhanced Auth Dialog"
Use the Facebook API. Ray Wenderlich has a good tutorial

Resources