Chrome Extension setup to allow JSON POLICY setup on Google Admin

84 views
Skip to first unread message

Audiebant App

unread,
Mar 11, 2025, 9:55:13 AM3/11/25
to Chromium Extensions

Hi there,

I'm trying to make a Chrome Extension targeted towards clients that can deploy their extensions through Google Admin Console.

The idea is that, once devices have the extension force installed and an email set via Google Admin Console, the background.js can automatically login the user and the app runs in the background seamlessly.

My problem is that, using my manifest file to publish my app, I can't see the option to set the JSON value in Google Admin Console. If you have another way to solve my problem, that'll be appreciated too.

Below is some relevant code, please tell me if it's not enough to deduce the problem.

Thank you!

Inside the background.js:

async function getManagedEmail() {
    return new Promise((resolve) => {
        chrome.storage.managed.get(["email"], (result) => {
            if (chrome.runtime.lastError) {
                console.warn("Error accessing managed storage:", chrome.runtime.lastError);
                resolve(null);
            } else {
                resolve(result.email || null);
            }
        });
    });
}

async function loginUser() {
    const managedEmail = await getManagedEmail() || null;

    if (!managedEmail) {
        console.log("No email found for background")
        return
    }
 
    const queryParams = new URLSearchParams({
        key: API_KEY,
        email: managedEmail,
    });

    try {
        ....
    } catch (error) {
        ....
    }
}

manifest.json:
{
    "manifest_version": 3,
    "name": "NAME",
    "version": "1.2",
    "description": "DESCRIPTION",
    "permissions": [
      "notifications",
      "storage",
      "alarms"
    ],
    "action": {
      "default_popup": "popup.html"
    },
    "background": {
        "service_worker": "background.js"
    }
  }
google-admin-console-screenshot.png
aiming for: example.png
Reply all
Reply to author
Forward
0 new messages