simov / grant

OAuth Proxy
MIT License
4.08k stars 257 forks source link

Garmin Provider #170

Closed BigPhatNerd closed 4 years ago

BigPhatNerd commented 4 years ago

Hey guys, total noob here, so not even sure how to do this. I am using Grant for Twitter and I went ahead and used it for Garmin as well and it did just fine. Keep up the good work. I greatly appreciate having Grant available. oauth.json

"garmin": {
  "request_url": "https://connectapi.garmin.com/oauth-service/oauth/request_token",
  "authorize_url": "https://connect.garmin.com/oauthConfirm",
  "access_url": "https://connectapi.garmin.com/oauth-service/oauth/access_token",
  "oauth": 1
}

In my config.json file:

{
  "defaults": {
    "origin": "http://localhost:3000",
    "transport": "session"
  },
  "garmin": {
    "key": "...",
    "secret": "...",
    "callback": "/garmin/redirect"
  }
}
simov commented 4 years ago

Thanks @BigPhatNerd, I'll add it to the list of officially supported ones :+1:

In the meantime you can define garmin directly in your config.json, no need to update anything in Grant:

{
  "defaults": {
    "origin": "http://localhost:3000",
    "transport": "session"
  },
  "garmin": {
    "request_url": "https://connectapi.garmin.com/oauth-service/oauth/request_token",
    "authorize_url": "https://connect.garmin.com/oauthConfirm",
    "access_url": "https://connectapi.garmin.com/oauth-service/oauth/access_token",
    "oauth": 1,
    "key": "...",
    "secret": "...",
    "callback": "/garmin/redirect"
  }
}
simov commented 4 years ago

Added in v5.2.0

manyaagarwal commented 4 months ago

Hey @simov follow up question here on the Garmin Provider.

Grant works really good and helps to make the OAuth flow real straightforward. With Garmin there is one extra step that needs to be performed to get the UAT from it. I was wondering I can doing this by changing any config on grant? Currently, in the callback I get an oauth_token and an oauth_verifier. Mainly asking because this request to fetch the UAT also requires a HMAC-SHA1 signature which I was currently relying on grant to generate for the first response 😅

Let me know if there is a possibility of a quick fix using grant, else happy to do this one request manually haha

simov commented 4 months ago

Not sure what UAT is, but in case you need to make additional request to the Garmin API after you have the access credentials then you can use the underlying HTTP client, available as a standalone module to make that additional call. Here is how to make a call using OAuth1.0a credentials https://github.com/simov/request-compose/blob/master/examples/mw-oauth.js

If UAT is about the user profile endpoint then you can try configuring the profile_url in Grant.

manyaagarwal commented 4 months ago

Thanks, that works!! @simov

i was actually able to resolve my main issue by reading the difference between redirect_uri and callback 😅