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

oauth 2.0 callback url issue

ANSWERED

Hi there,

 

I am having issue with my callback url. I have mentioned the same URL in fitbit app and for my application.

 

Here is the code snippet...

 

return this.oauth2.getAuthorizeUrl({

        response_type : 'code',

        scope : 'heartrate',

        redirect_uri : 'https://example.com/gettoken'

});

 

But it always gives me error after user authentication on Fitbit.

 

LOG:

{"statusCode":400,"data":"{"errors":[{"errorType":"oauth","fieldName":"redirect_uri","message":"Redirect_uri mismatch: null"}],"success":false}"}

 

I am unable to figure out the issue. Please help.

 

Thanks

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

redirect_uri should like "http://example.com/auth"

instead of "http%3A%2F%2Fexample.com%2Fauth"

View best answer in original post

Best Answer
11 REPLIES 11

Does your redirect_uri value match a URI specified in your app settings on https://dev.fitbit.com ?

Best Answer
0 Votes

Hi Jeremiah,

 

I have cross checked it several times and for sure i have exactly same vaules for redirect_uri and URI specified in my app settings.

Best Answer
0 Votes

Currently having the same problem. The uri is the same (even copy pasted to make sure) 

Best Answer
0 Votes

Hi TEvashkevich,

 

Did you find the solution?

 

It is getting tough for me and I really need multiple callback URL for the App, but it is not working for the single one.

If i leave the redirect_uri parameter, it works fine. Is it same in your case?

Best Answer
0 Votes

I haven't found a solution yet no. 

 

By leaving do you mean not having it in? Just leaving that part empty?  I by all means will give it a try 

Best Answer
0 Votes

If you do not pass the redirect_uri parameter, you will get the access_token after fitbit auth.

 

see the difference

 

With uri parameter:

https://api.fitbit.com/oauth2/authorize?response_type=code&scope=heartrate&redirect_uri=https%3A%2F%...

 

Without uri parameter

https://api.fitbit.com/oauth2/authorize?response_type=code&scope=heartrate&client_id=xxxxxxxx

 

Hope it will help you.

Best Answer
0 Votes

 Ah, I was getting the redirect_uri Mismatch in the Authorization step, where we have to POST to 

https://api.fitbit.com/oauth2/token
Best Answer
0 Votes

What was the solution here?

Best Answer
0 Votes

For the setup of the general OAuth2 stuff (Disregard the Unity Plugin I suggested here as it is not allowed anymore and I described how to do it without the plugin in the other post I link below.)

http://technicalartistry.blogspot.ca/2015/07/oauth2-unity-and-month-of-cursing.html

 

To change to native (which is needed now) 

http://technicalartistry.blogspot.com/2016/01/fitbit-unity-oauth-2-and-native.html

Best Answer
0 Votes

redirect_uri should like "http://example.com/auth"

instead of "http%3A%2F%2Fexample.com%2Fauth"

Best Answer
For me including redirect_uri param in the " .../oauth2/token " request solved the problem. Strange it would be required here since it is useless in a server side token request.
Best Answer
0 Votes