Adding a redirect-uri to a Dropbox application - oauth-2.0

I have a working Dropbox application, using oauth. I am extending the application and have added a new redirect-uri in the App Console. I am absolutely sure that the redirect uri is correct, but I am getting a 400 Invalid redirect-uri error. My uri begins with https:// as required.
Is there a delay before new redirect uris take effect?
This is the error:
More details for developers
Invalid redirect_uri: u'https://shareddom.ws/mse/auth/guest_portal.php'. It must exactly match one of the redirect URIs you've pre-configured for your app (including the path)
This the uri, cut and pasted from the App Console:
https://shareddom.ws/mse/auth/guest_portal.php

I don't think there should be any delay at all (certainly no more than a few seconds at most).
Those two strings appear to be identical, so my guess would be that the redirect URI isn't in the right place (or maybe under the right app?). Double check that the app key you're using matches the app key you're looking at in the App Console and that redirect URI is under the "OAuth 2 Redirect URIs" section of the page.
If you're still having trouble, I'd suggest opening a support ticket so we can double check the app details for you: https://www.dropbox.com/developers/contact.

Related

Correct Format of Harvest API OAuth2 Redirect URL in iOS Application

What is the correct format for a redirect URL when authenticating with OAuth2 and the Harvest API from an iOS application?
oauth.com states that a redirect URL for a native application can look like myapp://callback. Problem is, Harvest doesn't accept such a redirect URL. It seems to require prefixing it with http/https, which causes problems when redirecting back to the iOS application at the end of the authentication flow. I don't seem to find anything relevant in the Harvest API documentation.
I have added a URL Type in Xcode where I set the Identifier value to com.example.myapp and the URL Schemes value to MyApp. No matter what redirect URL I specify (given the format mentioned above) in Harvest the authentication flow always complains that Safari cannot open the page because the server cannot be found. I am able to open the app manually with the appname:// URL from the
It sounds like you're looking for the URL to use regarding redirection from a web call. I'm not certain on oath2, but on SAML it is something like
https://where you are signing in/SSOpage?RelayState=https://where you are going
I hope this helps get you to your answer.
If anyone else has this issue, the identifier and URL Schemes should not be com.example.myapp and MyApp, respectively. You only need to set the URL Scheme to com.example.myapp

Instagram API prevents redirection to iOS app upon successful login with 400 bad request error

I'm trying to integrate Instagram login into my app to get the logged in user's details, I've registered my app on Instagram and got my client ID, then I added a new URL Type in the project settings with the identifier: igxxxx (where xxxx is my client id), i've also set the redirect URI to be (xxxx://authorize), once I successfully log in (using a webView) Instagram displays a white blank page with (400 Bad Request) text written on top, however, when I change the redirect URI to anything else, it opens without problems after a successful login.
how can I redirect the user to the app after he logs in with Instagram.
p.s. I use this library to ease up things.
thanks in advance.
Here's what I have found so far. I have been able to resolve the issue to get the app to work on the iPhone. However, this solution doesn't allow me to submit the app on the app store as you will read ahead. I have submitted a bug with instagram, not sure how long they will take.
I would suggest everyone go to this link and "Report Issue":
https://www.instagram.com/developer/clients/manage/
I have had an app in app store for couple months without problems.
However, since June 19, all the users trying to authenticate get a white page with "400 Bad Request" after they login with their IG account.
The issue is very common as you will see on this stack overflow page:
Instagram API prevents redirection to iOS app upon successful login with 400 bad request error
And google shows the same issue with many users since June 19.
I have figured out that the old redirect URI which we were using:
myappname://
is the issue.
If we change this redirect URI to:
http://myappname
or
https://myappname
This all starts working fine and we get the access token.
However as per RFC1738, this is not a valid format for URL schemes which is used in iOS development.
So we get error when submitting our apps to app store:
ERROR ITMS-90158: "The following URL schemes found in your app are not in the correct format: [https: //myappname]. URL schemes need to begin with an alphabetic character, and be comprised of alphanumeric characters, the period, the hyphen or the plus sign only. Please see RFC1738 for more detail."
ERROR ITMS-90158: "The following URL schemes found in your app are not in the correct format: [https: //myappname]. URL schemes need to begin with an alphabetic character, and be comprised of alphanumeric characters, the period, the hyphen or the plus sign only. Please see RFC1738 for more detail."
So we can't submit to app store with this solution.
So unless instagram does something to fix this back to how it used to be, we are stuck :(

error:Redirect uri invalid for vimeo using oath in ios app

In my app I'm integrating OAuth2.0 library for vimeo upload. I'm getting error as invalid redirect uri after user log into his account.
My code,
self.oauthClient = [[LROAuth2Client alloc] initWithClientID:#"**** client ID ****"
secret:#" * secret * " redirectURL:[NSURL URLWithString:#"testMyApp://oauth"]];
In the plist i have given "testMyApp" as string in url schemes.
is this the right way to specify redirect uri? please help!
Your redirect url must 100% match the url configured on the developer site.
If your user is redirected to testMyApp://oauth your configured redirect url must be exactly testMyApp://oauth
The 3 pieces of information that you pass back to the Vimeo API (redirect_uri, code, grant_type) must be form URL encoded body parameters.
If they're being passed as query parameters, for example, the request will fail and return the error you're seeing.
For the Vimeo API to allow for your redirect, you have to register it for your app with the developer site. When it is registered there you are able to use it when you specify the redirect.
The plist scheme registration only notifies iOS that you can handle the scheme; Vimeo is unaware that it's a valid thing to redirect to for your app without this step.
The redirect url in the developer site must exactly match with the one in your application authentication request. I faced the same problem because of difference in the redirect url. But I fixed that and its working.
Developer site redirect url:
My app's request url:
https://api.vimeo.com/oauth/authorize?redirect_uri=vimeo608e5e6ffab5f7d2b567443f57684fdae8f8cb1c://auth&response_type=code&state=aee5252c-963c-4146-8358-a423326dd03c&scope=private%20public%20create%20edit%20delete%20interact&client_id=608e5e6ffab5f7d2b557443f57684fdae8f8cb1c
the value of the key redirect_url in above request is exact to the developer site. Please feel free to comment..
In my case, I had forgotten to enable implicit authentication and was getting the missing redirect_uri message.

What's a redirect URI? how does it apply to iOS app for OAuth2.0?

Beginner programmer here, please pardon ignorance & explanations will be really nice :)
I've tried to read the tutorials for a certain OAuth 2.0 service, but I don't understand this redirect URI... in my particular context, let's say I'm trying to build an iPhone app that uses OAuth 2.0 for some service. I have an App ID that was generated, but i need to provide some sort of redirect URI to generate the API key.
Is this a URL that I'm supposed to host somewhere myself?? As the name suggests, I would think that the redirect URL is supposed to "redirect" someone somewhere. My only guess is that it's the URL a user is redirected to after they log in to the service.
However, even if that assumption is correct, I don't understand one other thing - how can my app be opened again after I've sent them to the browser for the user login?
Read this:
http://www.quora.com/OAuth-2-0/How-does-OAuth-2-0-work
or an even simpler but quick explanation:
http://agileanswer.blogspot.se/2012/08/oauth-20-for-my-ninth-grader.html
The redirect URI is the callback entry point of the app. Think about how OAuth for Facebook works - after end user accepts permissions, "something" has to be called by Facebook to get back to the app, and that "something" is the redirect URI. Furthermore, the redirect URI should be different than the initial entry point of the app.
The other key point to this puzzle is that you could launch your app from a URL given to a webview. To do this, i simply followed the guide on here:
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
and
http://inchoo.net/mobile-development/iphone-development/launching-application-via-url-scheme/
note: on those last 2 links, "http://" works in opening mobile safari but "tel://" doesn't work in simulator
in the first app, I call
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"secondApp://"]];
In my second app, I register "secondApp" (and NOT "secondApp://") as the name of URL Scheme, with my company as the URL identifier.
Take a look at OAuth 2.0 playground.You will get an overview of the protocol.It is basically an environment(like any app) that shows you the steps involved in the protocol.
https://developers.google.com/oauthplayground/
redirected uri is the location where the user will be redirected after successfully login to your app. for example to get access token for your app in facebook you need to subimt redirected uri which is nothing only the app Domain that your provide when you create your facebook app.
If you are using Facebook SDK, you don't need to bother yourself to enter
anything for redirect URI on the app management page of facebook. Just setup a
URL scheme for your iOS app.
The URL scheme of your app should be a value "fbxxxxxxxxxxx" where xxxxxxxxxxx is
your app id as identified on facebook.
To setup URL scheme for your iOS app, go to info tab of your app settings
and add URL Type.

Problems with redirection while implementing oAuth2 for blackberry using webworks

I am trying to implement a SoundCloud app for blackberry phones using webworks frame work.
I am using OAuth2 scheme for authorization. So far I am able to display the SoundCloud log-in page from where the user can allow the app. But the problem occurs during the redirect which is essentially done by SoundCloud. The redirect page which is being pointed to by the call back URI is residing in my device, but after the user approves the app I get a page saying "something went wrong". However when I try to bounce the redirect from a third server, it just works fine. In this case I specify the callback URL pointing to a page on a website which only forwards the request to the page which is residing on my device. But the problem is that I do not want to use this "bounce server"
Could you please look into the code and advise if I am doing something wrong.
/**
* Authenticates the app against soundcloud
* This javascript method is called in the index.htm of my application.
*/
authenticate : function(){
var url = "https://soundcloud.com/connect?" + "scope=nonexpiring&client_id=MY_CLIENT_ID&" +
"response_type=code&redirect_uri=local:///testpage.htm";
window.location = url;
;
/************************************/
testpage.htm only displays "hello sound cloud".
Any help in this regard shall be highly appreciated.
The value for the redirect_uri parameter must match the value of the "Redirect URI" on the app edit page.
Example: https://img.skitch.com/20120411-q6yqada29tcadnep15jc6q75a1.jpg
IHTH
Hannes
The problem is the triple slash part in your redirect_uri. Although, it is a valid URI according to the RFC 3986, the Ruby URI library behaves a bit strange when parsing such values. We're working on a fix.
In the meantime, could you try to use local:/testpage.htm?

Resources