1

So, I am trying to obtain the eBay OAuth access_token (created when a user authorizes my app) back into my React app from the result of it being sent from ebay to an endpoint I created /api/ebayaccepted and have gotten stuck because I don't know how to get that back to my app once the access_token comes through.

I have created a page in React with a button meant to display an eBay OAuth link after user clicks.

If successful, eBay grants the access_token and sends it to my express endpoint /api/ebayaccepted.

However, I am doing all this testing from my local machine, namely localhost:3000 (frontend) and localhost:8000 (express backend). So, to bypass the https requirement by ebay I am using ngrok to produce links that look like https://8e37hhnc176c.ngrok.io/api/ebayaccepted which go in the ebay RuName settings. Due to using my local pc for testing I am using http://localhost:8000/api/ebayaccepted which is a no-no for the eBay redirect url.

All is well and good until I have to obtain the access_token because by clicking the link created by clicking that initial button, it opens a new page that I cannot access the localstorage or cookie for. I am at a loss as to how to get this back to my redux React frontend app. I thought about having it write this token to a temp file on the server but I don't like that potential security risk.

How can I return the access_code returned from eBay to my app?

Attempts:

  • Tried res.cookie by returning a view page which ultimately showed me that wouldn't work because it's a new tab that opens and even tho you could put a cookie in, it just cannot be seen by my app :(
  • Tried res.send() with res.cookie but that STILL produces another unrelated tab
rom
  • 666
  • 2
  • 9
  • 31

0 Answers0