Skip to content

Instantly share code, notes, and snippets.

@yashomi-t3h
yashomi-t3h / background.js
Last active January 31, 2025 15:48
Authenticating on chrome extension with OpenSaas/wasp-lang backend
//extn/background.js
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.type === "LOGIN") {
saveUser().then((response) => {
console.log("Login response: ", response);
chrome.storage.sync.set({ token: response.token }, function () {
console.log('Token is set to ' + response.token);