Conversation
add possibility for grantless requests
|
@ericcj pinging you in case you didn't get notification and are interested! |
ericcj
left a comment
There was a problem hiding this comment.
this looks great thank you let's just simplify the config so it doesn't have separate lambdas for different types of tokens and if you could write a bit about how you tested it that would be appreciated i'd like to release a new version including this
| config.get_access_token = -> (access_token_key) { Rails.cache.read("SPAPI-TOKEN-#{access_token_key}") } | ||
|
|
||
| # optional lambdas for caching grantless LWA access token instead of requesting it each time, e.g.: | ||
| config.save_grantless_access_token = -> (access_token_key, token) do |
There was a problem hiding this comment.
the lambdas already take an "access_token_key" which is the cache key to save the token under, let's use the same lambdas just vary the key similar to what i did for RDT https://github.com/ericcj/amz_sp_api/pull/55/files#diff-e2f2fe4083a87c67a20260d6f13385b63f2b64f0cabdcdf4e2f332fa754fbb5bR16
that way we can also remove the indirection of using public_send as well
and after that change the only readme update needed should be to clarify that refresh_token isn't required if you want to use only using grantless operations.
|
@ericcj will do sometime in upcoming week! |
This pr checks whether request is being made to an endpoint which requires grantless access token.
Endpoints gathered from- https://developer-docs.amazon.com/sp-api/docs/grantless-operations
Relevant issues:
#38
#3
Tested with notification endpoints. Code is not affecting any of generated code parts, so that shouldn't be an issue.