You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 1. Add a `X-Shopify-Access-Token` header to the request.
* 2. Check response for `X-Shopify-API-Request-Failure-Reauthorize` header.
* 3. Redirect the user to the reauthorization URL if the header is present.
*
* @returns {Function} fetch function
*/
exportfunctionuseAuthenticatedFetch(){
This header is not added, and indeed it should not be - the Access Token should be added on the backend, not from the frontend, if I'm reading Shopify docs correctly. This OAuth tutorial explicitly says that this header is added on the backend, and the App Bridge tutorial says that authenticatedFetch is supposed to add the Session Token under the Authorization header.
Expected behavior
The comment should be rewritten to explain what the function actually does:
It adds an Authorization header to the request, with the value Bearer <Session Token Here>
Actual behavior
Inaccurate comment
The text was updated successfully, but these errors were encountered:
Issue summary
The comment in useAuthenticatedFetch seems to be inaccurate:
shopify-frontend-template-react/hooks/useAuthenticatedFetch.js
Lines 5 to 17 in 1e92031
This header is not added, and indeed it should not be - the Access Token should be added on the backend, not from the frontend, if I'm reading Shopify docs correctly. This OAuth tutorial explicitly says that this header is added on the backend, and the App Bridge tutorial says that
authenticatedFetch
is supposed to add the Session Token under theAuthorization
header.Expected behavior
The comment should be rewritten to explain what the function actually does:
Authorization
header to the request, with the valueBearer <Session Token Here>
Actual behavior
Inaccurate comment
The text was updated successfully, but these errors were encountered: