We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Mark L.45
10 years agoCollaborator | Level 9
URI HTTPS request
Hi,
I am trying to follow this dropbox tutorial; but with success
https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/
I tried this call using the parameters shown an...
Mark L.45
10 years agoCollaborator | Level 9
OK, I tried the redirect_receiver and got nothing back I understand. Here is my code. Tried this with a simple curl too...
let request = NSMutableURLRequest(URL: NSURL(string: "https://www.dropbox.com/oauth2/authorize?client_id=X&response_type=token&redirect_uri=https://www.dropbox.com/1/oauth2/redirect_receiver&state=MTIzNDEyMzQ=")!)
let session = NSURLSession.sharedSession()
request.HTTPMethod = "GET"
let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in
if let error = error {
completion(string: nil, error: error)
return
}
let strData = NSString(data: data!, encoding: NSUTF8StringEncoding)
print("getAuth: \(strData)\n\n")
do {
let jsonResult = try NSJSONSerialization.JSONObjectWithData(data!, options:NSJSONReadingOptions.MutableContainers);
completion(string: ", error: nil)
} catch {
completion(string: nil, error: error)
}
})
task.resume()
Obviously X here, is my client ID. It returns data, which presumably is parsable if you're running this thru a web browser which as you can see I am not. The guide talks about acting on the authorisation code? which is found where in this 128 lines of text that comes back? I need to run the subsequent http request as I understand the guide? But using the auth code I find under what in this response?
https://www.example.com/mycallback?code=<authorization code>&state=<CSRF token>
Still lost on the client ID? How does it know the login credentials of the client if all I am giving it is the app ID I setup; I need this to be accessing the local dropbox of the client it is running under.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!