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

3

7

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!

enter image description here

Concrescence answered 23/10, 2015 at 19:31 Comment(1)
Can you post what URL you are trying to open that gives you this problem? It is hard to reproduce the bug without any information.Nisi
C
2

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.

Concrescence answered 27/10, 2015 at 13:28 Comment(0)
D
2

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/

Desdamona answered 2/11, 2015 at 16:34 Comment(0)
O
0

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:-

  1. 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).

  2. 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!

Oblique answered 27/10, 2015 at 5:25 Comment(1)
Sorry, this doesn't answer the question. The fact that it works via vanilla safari redirect seems to mean that all our callbacks are set up correctly. It's only when foursquare redirects us inside their app that this fails.Concrescence

© 2022 - 2024 — McMap. All rights reserved.