chrome-ext-oauth-sdk

OAuth SDK for Chrome Extensions

Usage no npm install needed!

<script type="module">
  import chromeExtOauthSdk from 'https://cdn.skypack.dev/chrome-ext-oauth-sdk';
</script>

README

Chrome Extension OAuth SDK

To implement OAuth flow on your Chrome Extension.

Why?

// TODO: Write something

How to use

// background.js
import { TwitterOAuth } from "chrome-ext-oauth-sdk";
window.twitter = new TwitterOAuth(yourConsumerConfig);
// Your callback page JavaScript
import { ProxyPage } from "chrome-ext-oauth-sdk";
const page = new ProxyPage();
window.onload = () => page.onload();
// then, this page will handle everything automatically
// and finally give token to the opener of this page.
// Let's open the page and trigger OAuth flow.
import { ProxyPage } from "chrome-ext-oauth-sdk";
const token = await ProxyPage.open(yourCallbackPageURL, "twitter");
// { access_token: string, access_token_secret: string }