Provide a way to access the request-id when refreshing an access token
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- ruby
- Domain
- api, authentication, backend
Research direction
Start in lib/shopify_api/auth/refresh_token.rb at refresh_access_token, then inspect client.request, response.body, and the ShopifyAPI::Auth::Session construction. Trace how successful and failed responses are handled; done means callers can obtain the request-id in both cases while existing token-refresh behavior remains available.
Written by the indexing model from the issue text.
Description
Background
When using ShopifyAPI::Auth::RefreshToken.refresh_access_token (lib/shopify_api/auth/refresh_token.rb) to refresh an offline access token (calling POST /admin/oauth/access_token with grant_type=refresh_token), we've run into an issue where the request itself succeeds, but the refresh_token returned in the response has an expiry that is far shorter than the documented 90 days.
- Reported on the Shopify Community forum:
https://community.shopify.dev/t/refresh-token-returned-with-an-expiry-far-shorter-than-the-documented-90-days/35880
In that thread, a Shopify staff member asked whether we had the request-id from the response (since it would help speed up their investigation). However, the return value of refresh_access_token — a ShopifyAPI::Auth::Session — provides no way to obtain the request-id, so we were unable to provide it.
Looking at the current implementation of refresh_access_token:
https://github.com/Shopify/shopify-api-ruby/blob/8c72cd222d346472a29e51c7a7dfb6b7239f7456/lib/shopify_api/auth/refresh_token.rb#L18-L54
The response object returned by client.request presumably includes the response headers (which contain the request-id), but only response.body is used to build the Session — the response itself is never exposed to the caller. As a result, there's no way for callers to retrieve the request-id.
Request
- Provide a way for callers to obtain the request-id when
refresh_access_tokenis used to refresh an access token- e.g. include the request-id on the return value (e.g.
Session) - or return an object that includes the response headers, allow passing a callback, etc. — any approach along these lines would work
- e.g. include the request-id on the return value (e.g.
- This should be available for both successful and failed responses (including cases like this one, where the HTTP request succeeds but the returned data itself is problematic)
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 484
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/shopify-api-ruby
-
devtools-gardener
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Shopify/shopify-api-ruby#1456 · 3 reactions ·
-
devtools-gardener
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Shopify/shopify-api-ruby#1461 ·
-
automated
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Shopify/shopify-api-ruby#1460 ·
-
devtools-gardener
Difficulty 5/5 Over a week Newbie friendliness 35/100
Shopify/shopify-api-ruby#1455 ·
-
automated
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Shopify/shopify-api-ruby#1452 ·
All issues in Shopify/shopify-api-ruby
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100