ChromeKit
HomepagePricing
  • 👋Get Started
  • 💡What you get?
  • 🔬Chrome Extension Types
  • ☄️Examples
  • ⚡Extension directory
  • 🖌️Initialise
    • Content script
    • Content script Sidebar
    • Sidepanel
    • Popup
    • IFrame (Content script sidebar from web app)
    • IFrame (Content script sidebar from extension files)
  • 🔧Feature
    • Auth External Communication
    • Session auth
    • Supabase auth
    • Welcome page
    • Uninstall page
  • 🧩Component
    • Twitter
    • License
    • Floating Input
  • 📙Guidelines (Only for purchased users)
    • Message passing
    • Permissions
    • Chrome web store
    • Tips
  • ❓FAQ
    • How to get extension id?
    • Common
Powered by GitBook
On this page
  1. Feature

Session auth

PreviousAuth External CommunicationNextSupabase auth

Last updated 10 months ago

If you have a web app and you store the auth token in a cookie, you can make use of it for authentication in your extension.

You can access the cookie in the extension and make authenticated API calls using the same.

Install

Before you add session-auth, ensure you have the initial extension setup. If you have not done that first and then comeback here.

npx ChromeKit-Org/cli add session-auth

When you need to read the cookie, send a message from your content script like this.

let response = await chrome.runtime.sendMessage({
  message: {
    type: "fetch-cookie"
  }
});

console.log(response.cookie);

Note: Ensure to update the right url in host_permissions in manifest.json file and the url in background.js script.

🔧
initialise