openmhealth / shimmer

An application for reading health data from third-party APIs.
Apache License 2.0
443 stars 122 forks source link

Trying to get postman to work with the shim #127

Open rasalt opened 3 years ago

rasalt commented 3 years ago

I have the dockerized version of shimmer running. I've configured postman Its doing a GET on {{api-base-url}}/authorize/{{shim-key}}?username={{username}} api-base-url is http://35.222.111.95 shim-key is fitbit username is user1

shimmer is setup with my fitbit client id/ key etc. I am getting this error "Could not get any response There was an error connecting to http://35.222.111.95/authorize/fitbit?username=user1. Why this might have happened: The server couldn't send a response: Ensure that the backend is working properly Self-signed SSL certificates are being blocked: Fix this by turning off 'SSL certificate verification' in Settings > General Proxy configured incorrectly Ensure that proxy is configured correctly in Settings > Proxy Request timeout: Change request timeout in Settings > General"

I have disabled postman proxy settings and turned off SSL.

Please advise what to expect and how to make progress. I am wanting the open mhealth version and that is it. Would be very very grateful for the help. Desperately wanting to move past this to have a pipeline flowing through shimmer.

rasalt commented 3 years ago

I made a bit of progress and got this as part of the response as part of the "initiate authorization"

"authorizationUrl": "https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=%2223B8T2%22&redirect_uri=http://localhost:80/authorize/fitbit/callback&scope=activity%20heartrate%20sleep%20weight&state=I8XSBu&prompt=login%20consent",

Pasting the url value in the browser gives me this error:

"The app you're trying to connect did not provide valid information to Fitbit. Please report this issue to them.

Developer information: unauthorized_client - Invalid client_id" In the url, what is the "state" value ? and does that redirect look decent ?

rasalt commented 3 years ago

Please advise on the authorizationUrl above.

A followup question is, do you anticipate shimmer to be used in a "pull model" alone ? i.e. applications pulling wearables data at their cadence ? fitbit provides a subscriptions API which can be used to notify applications regarding data availability and the application then makes relevant calls to pull data from the fitbit servers. I didn't find a similar concept and am assuming, seeing the POSTMAN setup that the model assumed is a pull model. Would be super appreciative if someone can confirm. I also don't know whether this repo is still in use or abandoned. Thank you.

walkabilly commented 3 years ago

The repo is not dead. Thanks for contributing.

  1. Working on the URL question now. Will respond when I have a good answer.
  2. Pull model is correct.
Nanared1 commented 3 years ago

Hi @rasalt, can you please confirm that the redirect_uri is the same URI configured in you Fitbit Developer dashboard? The URIs need to match, otherwise, fitbit won't return any data.

Thank you!

HimavarshaVS commented 3 years ago

Hi I've dockerized the application and tried to authorize an user to get data from fitbit. I tried "initiazation request" in postman setup . I received a response like which has clientRedirectUrl : null and requestParams": { "redirect_url": null } I pasted the authorization url in browser which has a callback url exactly the same as configured in fitbit dev app. I get _Developer information: invalid_request - Invalid redirect_uri parameter value_ Can you please help me on this as I couldn't authorize any user .