01-10-2018 07:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-10-2018 07:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Happy New Year...
Can I get a little help here please.. it might just be the christmas cobwebs .. 2 weeks away from it..
If someone could just take a quick look they might possibly spot something obvious but I can't see it...
This used to work before christmas and now doesn't... trying to get the authorization flow going again...
But I keep getting the Invalid redirect_uri parameter value error....
I redirect as follows :
I do a res.redirect on the following Redirect URL from my node app
(using ngrok to tunnel to my laptop while I'm developing...)
https://www.fitbit.com/oauth2/authorize?scope=activity%20heartrate%20location%20nutrition%20profile%...redirect_uri=https%3A%2F%2F1bae8b38.ngrok.io%2Fcallback&prompt=none&state=&response_type=code&client_id=22CL97
Then when the redirect happens, the login page shows up (cos user has already authorised the app) .. the url becomes as follows... (note the redirect uri looks odd...)
https://www.fitbit.com/login?disableThirdPartyLogin=true&redirect=%2Foauth2%2Fauthorize%3Fclient_id%...edirect_uri%3Dhttps%253A%252F%252F1bae8b38.ngrok.io%252Fcallback%26response_type%3Dcode%26scope%3Dactivity%2Bheartrate%2Blocation%2Bnutrition%2Bprofile%2Bsettings%2Bsleep%2Bsocial%2Bweight%26state%3D
So looks like the encoding is a bit strange eh?
And when I complete the login I finally get the error message:
Developer information: invalid_request - Invalid redirect_uri parameter value
So, something is not right.. but I can't put my finger on it quite yet.. could someone please have a quick look at see if you can spot anything obvious?
Thanks
PJ
Answered! Go to the Best Answer.

- Labels:
-
JavaScript
Accepted Solutions
01-10-2018 17:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



01-10-2018 17:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi PJ,
Is the `redirect_uri` param that you are using, the same uri as registered with your application? Regardless of the encoding the redirect should work.

01-10-2018 07:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-10-2018 07:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Please note, I've already tried this with the interactive oauth 2 interface (Fitbit API Debug Tool) and I'm getting the same results.. looks to me like the fitbit server code is double encoding the uri.

01-10-2018 17:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



01-10-2018 17:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi PJ,
Is the `redirect_uri` param that you are using, the same uri as registered with your application? Regardless of the encoding the redirect should work.

01-11-2018 00:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-11-2018 00:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi Siddhi,
Thanks so much for taking the time to look at my problem.
I thought it might be something dopey.. and it was.. you made me look again at the registered uri...
And while I did have the host name correct .. I was missing the /callback path on the end...
Sorry.. cobwebs..
Thanks again for your time,
PJ

