Skip to content

Instantly share code, notes, and snippets.

@jokamjohn
Created October 21, 2021 09:48
Show Gist options
  • Save jokamjohn/2a351285c6bc262b018e7a051a57cacf to your computer and use it in GitHub Desktop.
Save jokamjohn/2a351285c6bc262b018e7a051a57cacf to your computer and use it in GitHub Desktop.
/*global chrome*/
import './App.css';
import {useEffect} from "react";
const sendTokenToChromeExtension = ({ extensionId, jwt}) => {
chrome.runtime.sendMessage(extensionId, { jwt }, response => {
if (!response.success) {
console.log('error sending message', response);
return response;
}
console.log('Sucesss ::: ', response.message)
});
}
function App() {
useEffect(() => {
sendTokenToChromeExtension({ extensionId: 'joeibnoddmkbggaacjmfnefdmpdgpkmb', jwt: 'xxxxx.yyyyy.zzzzz'})
}, [])
return (
<div className="App">
<header className="App-header">
<h1>Chrome extension Token authentication</h1>
<p>The token to be sent is <code>xxxxx.yyyyy.zzzzz</code></p>
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment