login - Log in to my web from a chrome extension -


I have found a web site where users can fill out a form to send information to log in. I would like my users to be able to do this with Chrome extension too. I managed to get the form to get the information to work, but I only want to log in users. This is like a twitter or springpad extension, when the user first opens the extension, they must log in or register. I saw the following answer on stack overflow:

I gave it a try and put this code in the background. Html:

  function login () {$ .ajax ({Url: "http: // localhost / login", type: "GET", data type: "html", success: function () {$ .ajax ({url: "http: // localhost / login", type: "post", data: {"email": "me@alberto-elias.com", "password": "mypassword" ,}, Data type: "html", success: function (data) {// you can now parse the report screen}});}}); }   

In my popup, I enter the following code:

  var bkg = chrome.extension.getBackgroundPage () $ (document) .ready (function ) {$ ('#pagegaf'). Val (bkg.getBgText ()); bkg.login ();});   

And in my server, which is in node.js, I got the console.log, when the user shows information when logged in, so I saw that when I load my extension I do, it logs in. The problem is that instead of putting my details manually into the code, the user will be able to log in to the extension and submit the user's details when submitting the form.

I hope that I have explained myself correctly.

Thank you.

Before answering this question, I will bring your information to you if you are justified as Chrome 13 You can declare the quote from the page here

Version Note: As Chrome 13, content scripts can make cross-root requests from the same server as other extensions. Prior to Chrome 13, Content Script could not directly access requests; In return, he had to send a message from his original detail so that he could be asked in detail to make a cross-all request.

Coming to this point you just have to do an XmlHttpRequest in your domain from your extension (content script or background page) and wait for the response.

Server

Read request and session cookie, if the session sends a valid feedback, send an error code. 401 or something else.

Customer

If the response is displayed properly, then direct a login link to your website's login page.

How it works:

This will work if cookies are enabled in the user's browser. Whenever a user logs in to your website, your server sets a session cookie that is in the user's browser. Now with every request that the browser sends to your domain, this cookie is broadcast. This cookie will be transmitted even if the request is from the Google Chrome extension.

Warning

Make sure you display the appropriate signals for the user, indicating that they are logged in to your app. Since your UI will be mostly in detail, it is possible that the user does not know about your legitimate session with your website and leave an active session which may be inappropriate if the user accesses it from the public Internet kiosk Used to be. / P>

Reference

You can take a look at an implementation that I have done with my extension.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -