03-10-2016 00:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-10-2016 00:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I am using auth0 to authenticate fitbit in swift. I am able to get the access_token and id_token and user profile info using auth0 api. But when I make request to fitbit api I get an error stating invalid token. Please Help!!
03-10-2016 10:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



03-10-2016 10:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
We can't debug your application, but if you share the HTTP request that your app is actually making and the response, we can help identify the issue. You can use a tool like Runscope Traffic Inspector.

03-10-2016 23:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-10-2016 23:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am getting this error:
{
errors = (
{
errorType = "invalid_token";
message = "Access token invalid: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL215Zml0YXBwLmF1dGgwLmNvbS8iLCJzdWIiOiJmaXRiaXR8NDI5TlBHIiwiYXVkIjoiTkRzZ2pZRGZNUFd3d2M1MTNPbTREcUdXS2FDOTNHZDIiLCJleHAiOjE0NTc3MTgyNTMsImlhdCI6MTQ1NzY4MjI1M30.7hR0r24Ztq9wiIr_y2SSQhyFkhDs1g0Rj-8SkNGytm8. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.";
}
);
success = 0;
}
The request I am making is:
let targetURLString = "https://api.fitbit.com/1/user/-/profile.json"
let request = NSMutableURLRequest(URL: NSURL(string: targetURLString)!)
request.HTTPMethod = "GET"
request.setValue("Bearer \(idToken!)", forHTTPHeaderField: "Authorization")
let session = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
let task: NSURLSessionDataTask = session.dataTaskWithRequest(request) { (data, response, error) -> Void in
do{
let dat = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) as! NSDictionary
NSUserDefaults.standardUserDefaults().setObject(dat, forKey: "dataDictionary")
NSUserDefaults.standardUserDefaults().synchronize()
print(dat)
}
catch{
print("Could not convert JSON data into a dictionary.")
}
}
task.resume()

07-07-2017 10:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-07-2017 10:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Im having the exact same error using Auth0. Were you able to find a solution?

