-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Getting User Token without Selenium automation? #56
Comments
Albert, When the following are blank, Selenium is used to get refresh tokens.
Instead, do something like this, with, of course, your token info.
Use of an ebay_rest.json file is optional; the Class initializer accepts relevant keyword parameters.
Sample code.
When using eBay's sandbox:
Output.
Did I understand your question, and is my response satisfactory? |
Thank you for this detailed and quick response. But I was more wondering if there was a way to not have to provide the user's credentials in the API object constructor directly, so the user could log in themselves. It seems to me the user's credentials must be provided in some way to the API before logging in (either through the keywords or the json file). For example, my application is trying to create listings on the user's sandbox account through this library,.so it would require them to login manually. |
Re. It seems to me. eBay is rigid and only provides one or two ways of doing things. My understanding of what eBay expects and prefers is baked into the eBay-rest library. If you want to modify ebay-rest to make it more flexible, a PR would be warmly received. Re. My application is trying to create listings on the user's sandbox account. You are fortunate; dozens and maybe even hundreds of applications and websites already do that; they give you viable examples. Have you found one that handles eBay credentials in a way your end-users will like and tried to mimic it? |
An easy option is to switch ebay_rest from Selenium to Playwright and, while doing so, make it headless. This would also eliminate a chrome driver dependency. Requests is already a dependency, so utilizing it would be even better; more labour to implement. |
Upon further consideration, urllib is already baked into the Swagger-generated code, so using urllib would be better than Requests because it makes progress towards reducing dependencies. |
In answer to a user's question. Note that the “production_refresh_token” and “refresh_token_expiry” are dumped to the log file. That happens in this file https://github.com/matecsaj/ebay_rest/blob/main/src/ebay_rest/token.py, where the following line is located. If your project uses log-level info or higher, the info will appear in your log. Alternately, put a breakpoint after the line of code, and cut-paste the values. |
I determined that urlib or requests can't fully substitute for Selenium or Playwright because some pages rely on javascript. I also discovered that we don't need to switch to Playwrite to run headless; let us give this change e611789 |
The headless change was commented out until captcha automation is added. d1ad19c |
Perhaps some things have changed in a helpful way, give eBay's documentation a careful read. |
I use ebay_rest for a web server application and don't use Selenium to get refresh tokens. I use JS to push people to the right eBay web page when they click an 'authorize' button; they then fill in their login on the eBay site and I pick up the consent token on our 'live' server (the one specified on the eBay token details). The live server then builds a redirect which goes to the machine that actually requested the token originally (all this happens in the browser, including the original eBay redirect, so it all works fine with localhost addresses). (that said, I haven't tried updating to a new version of ebay_rest in a while and that would probably break everything as selenium seems to have become a required dependency again...) |
We don't need to keep this issue open.
|
Hi matecsaj,
Is there any way to avoid the Selenium automation when trying to get a user token? For example, instead of providing the user credentials in the ebay_rest.json file, to just go through the traditional OAuth flow where the login is provided by the end user?
Something like this would be useful in supporting multiple eBay users logging in.
Thanks,
Albert
The text was updated successfully, but these errors were encountered: