{"action":"created","issue":{"url":"https://api.github.com/repos/nxtbgthng/OAuth2Client/issues/200","repository_url":"https://api.github.com/repos/nxtbgthng/OAuth2Client","labels_url":"https://api.github.com/repos/nxtbgthng/OAuth2Client/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/nxtbgthng/OAuth2Client/issues/200/comments","events_url":"https://api.github.com/repos/nxtbgthng/OAuth2Client/issues/200/events","html_url":"https://github.com/nxtbgthng/OAuth2Client/issues/200","id":125832971,"number":200,"title":"FitBit: Authorization header required ","user":{"login":"chrisfoulds","id":16035209,"avatar_url":"https://avatars.githubusercontent.com/u/16035209?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisfoulds","html_url":"https://github.com/chrisfoulds","followers_url":"https://api.github.com/users/chrisfoulds/followers","following_url":"https://api.github.com/users/chrisfoulds/following{/other_user}","gists_url":"https://api.github.com/users/chrisfoulds/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfoulds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfoulds/subscriptions","organizations_url":"https://api.github.com/users/chrisfoulds/orgs","repos_url":"https://api.github.com/users/chrisfoulds/repos","events_url":"https://api.github.com/users/chrisfoulds/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfoulds/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-10T17:16:35Z","updated_at":"2016-03-08T15:49:34Z","closed_at":null,"body":"I am trying to connect to Fitbit in an iOS App\r\nhttps://dev.fitbit.com/docs/oauth2/#authorization-page\r\n\r\nI have put this code in the app startup\r\n ```\r\n    [[NXOAuth2AccountStore sharedStore] setClientID:@\"xxxxx\"\r\n                                             secret:@\"yyyyyyyy\"\r\n                                            scope:[NSSet setWithObjects:@\"activity\", @\"heartrate\", @\"weight\",nil]\r\n                                   authorizationURL:[NSURL URLWithString:@\"https://www.fitbit.com/oauth2/authorize\"]\r\n                                           tokenURL:[NSURL URLWithString:@\"https://api.fitbit.com/oauth2/token\"]\r\n                                        redirectURL:[NSURL URLWithString:@\"myapp://handleOauthLogin\"]\r\n                                      keyChainGroup:@\"\"\r\n                                          tokenType:@\"Bearer\"\r\n                                     forAccountType:@\"fitbit\"];\r\n    \r\n    NSMutableDictionary *configuration = [NSMutableDictionary dictionaryWithDictionary:[[NXOAuth2AccountStore sharedStore] configurationForAccountType:@\"fitbit\"]];\r\n    NSDictionary *customHeaderFields = [NSDictionary dictionaryWithObject:@\"application/x-www-form-urlencoded\" forKey:@\"Content-Type\"];\r\n    [configuration setObject:customHeaderFields forKey:kNXOAuth2AccountStoreConfigurationCustomHeaderFields];\r\n    [[NXOAuth2AccountStore sharedStore] setConfiguration:configuration forAccountType:@\"fitbit\"];\r\n\r\n ```\r\n\r\nIn my callback I do\r\n ```\r\n[[NXOAuth2AccountStore sharedStore] handleRedirectURL: url];\r\n ```\r\n\r\nand I invoke the auth using :\r\n ```\r\n[[NXOAuth2AccountStore sharedStore] requestAccessToAccountWithType:@\"fitbit\"];\r\n ```\r\n\r\nand I have the notification handlers that return as failure.\r\n\r\nThe app launches, safari, I login , say everything is ok, it then asks to return to my app.\r\nI say ok, it returns but the notification from storing the token says\r\n\r\n ```\r\noauthConnection Error: {\"errors\":[{\"errorType\":\"invalid_request\",\"message\":\"Authorization header required. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.\"}],\"success\":false}\r\n ```\r\n\r\nI just can not see what I have missed, any help appreciated."},"comment":{"url":"https://api.github.com/repos/nxtbgthng/OAuth2Client/issues/comments/193832457","html_url":"https://github.com/nxtbgthng/OAuth2Client/issues/200#issuecomment-193832457","issue_url":"https://api.github.com/repos/nxtbgthng/OAuth2Client/issues/200","id":193832457,"user":{"login":"chrisfoulds","id":16035209,"avatar_url":"https://avatars.githubusercontent.com/u/16035209?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisfoulds","html_url":"https://github.com/chrisfoulds","followers_url":"https://api.github.com/users/chrisfoulds/followers","following_url":"https://api.github.com/users/chrisfoulds/following{/other_user}","gists_url":"https://api.github.com/users/chrisfoulds/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfoulds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfoulds/subscriptions","organizations_url":"https://api.github.com/users/chrisfoulds/orgs","repos_url":"https://api.github.com/users/chrisfoulds/repos","events_url":"https://api.github.com/users/chrisfoulds/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfoulds/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T15:49:34Z","updated_at":"2016-03-08T15:49:34Z","body":"That is it ! - all the code I had to add was those two lines.\r\nI can't give the entire source file as it's under copyright "}}