Login on a site via google chrome extension - google-chrome

I want to make an extension for google chrome that watches for updating of information on a site. The problem is to do this I must to be logined on the site. Can I make an exsension so as it would ask a login and password from the site at start and then stores this information in the cookies? Does Chrome maintain abilities to make extension like this?

You don't have to do it. If you send a request from chrome extension to www.example.com - for example, the chrome extension adds the cookies from this site to your request. If the user isn't connected to example site, you can redirect him to login page in example.com and then continue. (Of course, you have to type "www.example.com" permission in manifest.json).
You can see sample from google- google mail checker.
(I'm sorry about my English).

Related

Get access to multiple gmail accounts in a chrome extension

I'm creating a Chrome extension that modifies the gmail UI.
But when I authenticate (with chrome.identity.getAuthToken) in the Chrome extension, it defaults to using the user account that is signed into Chrome.
But I need data for a gmail account when I am on that gmail page.
I saw this answer, but I was wondering if there was any easier way?
I just went through the same process and I couldn't find an easier way.
You'll need to authenticate yourself.
We tried using the mechanism in that link but it requires putting the Client Secret in the Extension - very ugly.
In the end we request and refresh tokens externally through a hosted web page from our www site.
Although a hassle to set up once in place it works nicely and is worth the effort.

How to auto-login website in chrome with saved password

Chrome is auto-filling the credentials, but not log me in until I click login. How to automate? (windows, non-google websites).
Using the Chrome Identity API you can have Chrome (on desktop and Android) automatically attempt to log in the user when they hit your page, even if their session has expired.
Following is a workflow diagram of how it works, but the details can be found in the Google Authentication API: Let the user automatically sign back in section:
It is not the browser's responsibility to auto-login to websites. This is the responsibility of the website you are accessing. The browser can remember form data and auto-fill for you, as can various extensions like LastPass.
However, in order to actually auto-login, you must first login to the website you are trying to access and enable the option they provide, often called 'Remember me?'. The website would typically use a cookie to store the credentials (securely with a hash + salt), and if the cookie still exists (not cleared from the browser or expired), and the hash of real password in database matches the one in the cookie, the website will auto-login.
You could force the browser to try and auto-login with extensions, which are essentially macros. You could try Auto Login or iMacros extensions for this. I would generally avoid this though.
Anyone else stumbling into this thread from a google search.... you can do this with autohotkey. If you browse to yourbankhere.com and chrome fills in the user/pass, you can have autohotkey perform a mousemove then a mouseclick to click the login button.

The cookie alert for allowing customers to save the cookies repeats and navigates to Enable Cookies page in Google Chrome

I am new to Magento and I have just setup Magento 1.8.1 with the sample data. I was going through the user guide of Magento CE 1.8.1 and came to know that Cookie restriction mode should be set to Yes because of European Union Privacy and Electronic Communications Directive and its amendment. But i am facing a issue now which I am unable to resolve. After changing the settings to Yes, I refreshed my site and I got the Allow Cookie Alert Box. I clicked Allow and I was directed to the Enable Cookies page. I again clicked allow on that page and was directed back to the same page as if it just refreshed. I am embedding screenshots for clear understanding:
the first one is the home page and the second one is the enable cookie page.
Few changes what I did was, I changed System -> Config -> General -> Web -> use http only to No. I did this because I was getting errorless Login page when I was trying to login on the backend in Google chrome and this was one of the solutions available on stack overflow. But I reverted this back to yes when I came to know that this makes the site vulnerable to attacks. That's why I did some changes in the varien.php file as described in the second solution of Why I can not login to magento backend using google chrome by a user named AKT. Also, I had set the Cookie Restriction Mode to YES. Does anyone have a solution to this? This is only happening in Google Chrome.

Google Chrome plug in to read saved cookies

I'm new to Google Chrome plug in development. I have learnt how to develop a basic plug in. Now the problem is I'm trying to make a plug in that can read saved cookies of a particular website you visit.
For instance, a user visits www.facebook.com, after login he will click on our plug-in icon and a drop down window will appear and show all the cookies saved by Facebook.
Here I want to ask how to read the cookies of the site you are visiting? Is that possible to sort cookies with respect to site you visit?
If yes? Can you provide me a reference of how it could be done?
There is a Cookies API that allows Chrome extensions to access the browser's cookies, without having to send HTTP requests to obtain those cookies. More references
This thread might also be helpful.

Auth redirect - opening a local HTML document in a new tab in a Firefox extension

I am currently trying to port a Chrome extension to Firefox.
The Chrome extension has a "Login" page, which is opened in a new tab as an HTML document. The HTML document is stored in the local directory with other extension files. The user inputs a URL which should represent a server running our application, where the user will be asked to login. After a successful login, the user is redirected back to the options.html page, which is updated to show the user's preferences.
I would like to duplicate this in the Firefox extension, i.e. I would love to avoid writing anything in XUL to build an options page.
I tried opening a new tab with my HTML page like this:
var url = "chrome://myextension/content/options.html";
var win = Components.classes['#mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser');
win.gBrowser.selectedTab = win.gBrowser.addTab(url);
But I don't like this for a few reasons: 1) The navbar in the new tab displays the "chrome:// ..." URL, and 2) it breaks the authentication process. The authentication is done using an OAuth type system, and the current URL is passed into the API so that the user can be redirected back upon successful authentication. The authentication fails with "chrome://" as part of the URL.
Just out of curiosity, I tried hardcoding the URL like this:
http://myextension/content/options.html
And the user is actually successfully authenticated, but then the redirect obviously fails afterward.
The Chrome extension seems to work with no problems or weird hacks. From what I can tell, opening it works like this:
chrome.tabs.create({"url":chrome.extension.getURL("options.html"), "selected":true});
And referencing the URL of the tab later so we can be redirected back to it just works like this:
var options_url = chrome.extension.getURL('options.html');
So, I'm wondering: what is the best way to open a local HTML document in a new tab with a Firefox extension, without using the "chrome://" "protocol"? Is there a similar way to how it can be done with Google Chrome extensions?
UPDATE 23/5/12
So this article says that chrome:// URLs are not accessible from the web, only locally.
http://adblockplus.org/blog/web-pages-accessing-chrome-is-forbidden
I think this could be the reason why my authentication was failing. I'm definitely looking for a way for my extension to display a local HTML file in a window or tab without using chrome://.
UPDATE 07/6/12
Here is my (hopefully temporary) solution:
The user enters the URL of the server running our application. He/she is redirected to the application login page, but instead of passing "chrome://myextension/content/options.html" as the URL to be redirected back to after authentication, I pass a phony URL, i.e. "http://myextension/thisis/madeup.html".
In my extension's overlay.js, I set up an HTTP request listener which listens for the phony URL being requested. When a GET happens for the phony URL, I cancel the request, and open the real, locally stored page at "chrome://myextension/content/options.html".
See the following references:
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIObserver
https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads#HTTP_Observers
If you're trying to do this redirect for an OAuth call you should try using OAuthorizer from Mozilla instead of doing the redirect work yourself. Hope that helps!