Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fitbit API with AFOAUATH2Manager Failing

ANSWERED

Hi everyone ..

This is my first interaction with fitbit auth and awful exp. my app written in Obj-c , there are not enough tutorial or example .. however i got this link to use http://stackoverflow.com/questions/36915238/get-authorization-from-fitbit-using-oauth-in-ios

but always getting stuck with error invalid_client , when i use same auth code at  hurl.it it works but not in app , will be great help if someone guide me 

 

Thanks Alot 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions
6 REPLIES 6

@iosDev What's the specific error? Invalid_client is just the error type.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

 

First of all thank you for your response , it really too fast 🙂

 

always it fails with error 400 or if i successfully remove 400 then 401 , and in response i received some NSData , after serializing it error type invalid client blah blah ....

do i'm using right steps ?? 

like link i posted says i will get auth auto , but i need to fillter callbackurl to get auth is it right ??

 

 

Best Answer
0 Votes

 

here is error 

 

{ URL: https://api.fitbit.com/oauth2/token } { status code: 400, headers {

    "Cache-Control" = "no-cache, private";

    "Content-Encoding" = gzip;

    "Content-Language" = "en-IN";

    "Content-Type" = "application/json;charset=utf-8";

    Date = "Mon, 19 Dec 2016 11:46:15 GMT";

    Server = "cloudflare-nginx";

    Vary = "Accept-Encoding";

    "cf-ray" = "313a9ce7b9212f05-DEL";

    "x-frame-options" = SAMEORIGIN;

} }

{

    errors =     (

                {

            errorType = "invalid_grant";

            message = "Authorization code invalid: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1NDNWNzUiLCJhdWQiOiIyMjdZRDkiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZXMiOiJ3aHIgd251dCB3cHJvIHdzbGUgd3dlaSB3c29jIHdzZXQgd2FjdCB3bG9jIiwiZXhwIjoxNDgyNzQ5OTQwLCJpYXQiOjE0ODIxNDc5NjB9.TD7XryjrY_CMelAIResEJRlj0MvywX91BxWh328TGsA Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.";

        }

    );

    success = 0;

}

Best Answer
0 Votes

@iosDev wrote:

 

            errorType = "invalid_grant";

            message = "Authorization code invalid: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1NDNWNzUiLCJhdWQiOiIyMjdZRDkiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZXMiOiJ3aHIgd251dCB3cHJvIHdzbGUgd3dlaSB3c29jIHdzZXQgd2FjdCB3bG9jIiwiZXhwIjoxNDgyNzQ5OTQwLCJpYXQiOjE0ODIxNDc5NjB9.TD7XryjrY_CMelAIResEJRlj0MvywX91BxWh328TGsA Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.";

 


@iosDev Looks like you're using an access token where you should be using an authorization code. See Access Token Request.

 

If you want to refresh an expired access token, then you need to use the refresh token.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes
Best Answer

@iosDev Thanks for sharing!

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes