How to automate login to Gmail?

Asked

Viewed 1,059 times

0

  • Do you want to upload the email to your website? Or do you want to request the email information? iframe?

  • This is not possible. Google would not allow such a security breach. The ideal is to use the libraries or API available in the language you are using in the project. ?

  • 2

    Not a single <iframe> help, @Felipeavelar: of course Gmail would block this because it would cause system security failures (not including terms of use and others yadda-yadda that no one reads).

  • @Go that he wants to make a Bookmark to enter the email without having to enter the password. Objectives are several and Apis maybe even unnecessary: if only he will use, an extension serves, although it is very insecure. If it is something better he will end up needing to make an email client (or use a).

  • Not possible. Gmail does not accept passwords by querystring. It is also useless to send cookies, tokens or any other way to get someone else to log in as you do on their machine. The person will have to enter the password somehow somewhere.

  • In fact, if it were possible to do what you want, Google could not be an Openid authentication source ;)

  • @Matheus I use an email manager with Delphi, and my goal is after sending the email to log in the Gmail account to which the email was sent.

  • 1

    Why not access by IMAP simply?

  • You can achieve this if you use an application for example, a C# with a Webbrowser controller (Webkit or Iexplore). This way Voce can manipulate the browser to do the automatic authentication in Gmail based on data from your application.

Show 4 more comments

2 answers

1

You can create a java or C++ server that plays the role of a Proxy for the content of the desired email. This server must use the Google Apis to connect to the email service. Your web page can communicate with this server using Websocket, JSONP, or AJAX with CORS enabled and in this case the request for this Proxy can have the format you want since you translate to the google API commands.

In this approach the customer should trust you and your architecture when passing the password because you could store it breaking security, but this can be negotiable.

0

There is currently a better alternative because Google has provided a platform for programming Scripts to run as a WEB application or linked to Google Drive documents. This solution is called Google Apps Script and is available in https://script.google.com.

See example below:

function doGet() {
    var app = buildApp();
    return app;
}

function myClickHandler(e) {
    var app = UiApp.getActiveApplication();

    var label = app.getElementById('statusLabel');
    label.setVisible(true);

    app.close();

    return app;
}

function buildApp() {
    var app = UiApp.createApplication();
    app.setTitle('criando aplicação')
    var button = app.createButton('Click Me');
    app.add(button);

    var label = app.createLabel('The button was clicked.').setId('statusLabel')
        .setVisible(false);
    app.add(label);

    var handler = app.createServerHandler('myClickHandler');
    handler.addCallbackElement(label);
    button.addClickHandler(handler);

    app.setTitle('aplicação criada com id ' + app.getId());

    return app;
}

You can see in this DOC who wrote some more details.

This approach is better than the one I suggested earlier because the Google Apps Script allows you to interact directly with Gmail and the entire Google Cloud infrastructure.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.