0

I'm working on an extension that will make request to Robinhood API and get all transaction history to generate a better report.

Initial thought, it will be easier to just grab auth token from chrome extension(background.js) and use that to make request to Robinhood API but seems like it's more complicated than I expected.

I can still see the authorization token on the Chrome browser console but can't find the way to grab that from my Chrome extension(pic below)

enter image description here

Thought webRequest API is the answer but found it won't provide Authorization info(https://developer.chrome.com/docs/extensions/reference/webRequest/)

chrome.webRequest.onBeforeSendHeaders.addListener((details) => {
    console.log(details);
  }, 
  { urls: ["<all_urls>"] },
  ["requestHeaders", "extraHeaders"]
);

I know there's Chrome extensions making http requests to Robinhood API with local auth token. What's the best way to grab that local auth token?

Thank you all!

Skate to Eat
  • 2,554
  • 5
  • 21
  • 53
  • 1
    webRequest is the correct method. [How to see background.js console?](/a/10258029) Also make sure your `permissions` or `host_permissions` include the site's URL and the request's URL. – wOxxOm Nov 16 '22 at 07:09
  • @wOxxOm Thank you for the comment. Yes, you are right. I see the Authorization info after adding `host_permissions` to manifest.json file. – Skate to Eat Nov 16 '22 at 20:17

1 Answers1

0

Thank you to @wOxxOm for the answer!

I was missing host_permissions in manifest.json. The Authorization token info shows up after adding that.

enter image description here

Skate to Eat
  • 2,554
  • 5
  • 21
  • 53