Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change refresh_token #5

Closed
LksNuns opened this issue Jun 3, 2021 · 11 comments
Closed

How to change refresh_token #5

LksNuns opened this issue Jun 3, 2021 · 11 comments

Comments

@LksNuns
Copy link

LksNuns commented Jun 3, 2021

Hi, I have an application, and I want to fetch data from Amazon for each user. I started to read the amazon documentation and this library.

Every time the user authorizes my app, we received a code from this user to generate an access_token and refresh_token through LWA.
Looking into the code I found

refresh_token: config.refresh_token,

I tried creating a new AmzSpApi::SpConfiguration.new to use in AmzSpApi::SpApiClient.new(config), but then all attributes come with nil.

There is a way to only change the refresh_token?

@LksNuns LksNuns changed the title How to change refresh token How to change refresh_token Jun 3, 2021
@LksNuns
Copy link
Author

LksNuns commented Jun 3, 2021

Sorry about opening this issue. I read more about the code of this gem, and figure out a way to do this.

@LksNuns LksNuns closed this as completed Jun 3, 2021
@philsmy
Copy link

philsmy commented Jun 5, 2021

Rather than all of us code diving, it would be great if you (or someone) could put newcomers to how to do that. That is step 1 of connecting to the SP-API and it is not totally clear - at least to me - how to do that. If it is in this code it would be nice to highlight it (or maybe even put it on the Readme)

@jakemcallister
Copy link

@LksNuns how did you do it?

@tarekrahme
Copy link

@philsmy @jakemcallister @LksNuns
Hello
Would love to know more about that please 🙏🏼

How to handle the first step? Does the gem handle the OAuth flow? How does my code know which Amazon vendor it is handling?

Thanks so much in advance

@blairanderson
Copy link

@philsmy instead of asking others to do work, why don't you dive in and submit a pull request?

@mendywoly
Copy link
Contributor

@tarekrahme There is some information here that might be helpful - #17.

@blairanderson
Copy link

Once you save it, the refresh token does not change. The client requests new access_token as needed.

This is how i'm instantiating API clients for each account in my application: https://www.blandersoft.com/short/sp-api/

@tarekrahme
Copy link

Thanks so much @blairanderson @mendywoly
So just to confirm, I have to handle OAuth flow first (not handled by this gem).

The OAuth flow will allow me to get the refresh token which I then use to make queries to the Amz SP API.

Correct? Am I missing something?

@blairanderson
Copy link

blairanderson commented Mar 28, 2023 via email

@mendywoly
Copy link
Contributor

@tarekrahme see if this helps you at all. #43

@tarekrahme
Copy link

Once again thanks a lot @blairanderson @mendywoly I really appreciate it
🙏🏼🙏🏼🙏🏼
Hopefully soon I can start contributing to the gem 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants