I have working cross-platform extension which I converted for Safari using xcrun safari-web-extension-converter PATH. Goal of extension is to bookmark any URL into my website account.
My extension is perfectly working fine for Chrome but for Safari version, everything works well if user allows access permission for every website.
The case is, when user presses extension button, we are checking user is logged into its account or not by opening our website URL into another tab.
When this AUTH tab is loaded, following method will be called as it happens in Chrome which in turn extracts public and private tokens generated when any user logs into our website.
The issue lies here is that until user does not grant for "Always Allow on Every Website" (I mean grant permission for https://www.OURDOMAIN.com/extension?extension=1), chrome.tabs.onUpdate is giving tab.url = "" and it does not give proper URL value so we come to know that particular user is signed in or not (we don't get that our domain tab is loaded or not due to this issue).
Do we have any way to allow access for our website without user's consent?
Following is our manifest.json:
Please check permissions and content_scripts properties where I tried to put proper options but no solution. I event tried externally_connectable but still without user's consent I am not able to receive proper URL for that particular tab.
Would you suggest me any solution of how I can authenticate my user here? The main authentication is done backend side only and I am not using any API here. I am just opening new tab which if loaded successfully authentication will be validated.
I hope my problem is clear. If there are any queries let me know.
My extension is perfectly working fine for Chrome but for Safari version, everything works well if user allows access permission for every website.
The case is, when user presses extension button, we are checking user is logged into its account or not by opening our website URL into another tab.
Code Block var openSignin = function openSignin() { console.log('hey'); chrome.tabs.create({ url: _config.baseURL + '?extension=1', active: false }); };
When this AUTH tab is loaded, following method will be called as it happens in Chrome which in turn extracts public and private tokens generated when any user logs into our website.
Code Block chrome.tabs.onUpdated.addListener(function (tabID, changeInfo, tab) { if (tab.status == 'complete' && tab.url.startsWith(_config.baseURL)) { chrome.tabs.executeScript(tab.id, { code: 'localStorage.getItem("PUBLIC")' }, function (r) { localStorage['PUBLIC'] = JSON.parse(r[0]); chrome.tabs.executeScript(tab.id, { code: 'localStorage.getItem("PRIVATE")' }, function (r) { localStorage['PRIVATE'] = JSON.parse(r[0]); if (localStorage['PRIVATE'] && tab.url === _config.baseURL + '?extension=1') { chrome.tabs.remove(tabID); } }); }); } });
The issue lies here is that until user does not grant for "Always Allow on Every Website" (I mean grant permission for https://www.OURDOMAIN.com/extension?extension=1), chrome.tabs.onUpdate is giving tab.url = "" and it does not give proper URL value so we come to know that particular user is signed in or not (we don't get that our domain tab is loaded or not due to this issue).
Do we have any way to allow access for our website without user's consent?
Following is our manifest.json:
Code Block { "name": "EXT NAME", "description": "DESCRIPTION", "manifest_version": 2, "version": "1.0.181", "minimum_chrome_version": "23", "offline_enabled": true, "browser_action" : { "default_icon" : { "64": "logo/stash.png" }, "default_title" : "Add to Stash" }, "background" : { "scripts" : [ "bundle.js" ] }, "content_scripts": [{ "js": [ "init.bundled.js" ], "matches": [ "<all_urls>" ] }], "icons": { "16": "logo/stash_small.png", "64": "logo/stash.png" }, "permissions" : [ "https://*.stash.ai/*", "activeTab", "gcm", "storage", "notifications", "identity", "contextMenus", "tabs", "idle" ], "externally_connectable": { "matches": ["https://*.stash.ai/*"] }, "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "web_accessible_resources": [ "corner.css", "js/init.js", "init.bundled.js", "js/jquery.min.js", "js/taggle.min.js", "js/typeahead.bundle.min.js", "ext.html.js", "assets/*" ], "commands": { "_execute_browser_action": { "suggested_key": { "default": "Ctrl+Shift+S", "mac": "Command+Shift+S" }, "description": "Send a link to Stash!" } } }
Please check permissions and content_scripts properties where I tried to put proper options but no solution. I event tried externally_connectable but still without user's consent I am not able to receive proper URL for that particular tab.
Would you suggest me any solution of how I can authenticate my user here? The main authentication is done backend side only and I am not using any API here. I am just opening new tab which if loaded successfully authentication will be validated.
I hope my problem is clear. If there are any queries let me know.