I am trying to use Gmail API javascript code to access others email, code is as below :-
function authenticate() {
        return gapi.auth2.getAuthInstance()
            .signIn({ scope: "https://mail.google.com/ https://www.googleapis.com/auth/gmail.compose https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/gmail.readonly" })
            .then(function () { console.log("Sign-in successful"); },
                function (err) { console.error("Error signing in", err); });
    }
    function loadClient() {
        return gapi.client.load("https://content.googleapis.com/discovery/v1/apis/gmail/v1/rest")
            .then(function () { console.log("GAPI client loaded for API"); },
                function (err) { console.error("Error loading GAPI client for API", err); });
    }
    // Make sure the client is loaded and sign-in is complete before calling this method.
    function execute() {
        return gapi.client.gmail.users.getProfile({})
            .then(function (response) {
                // Handle the results here (response.result has the parsed body).
                console.log("Response", response);
            },
                function (err) { console.error("Execute error", err); });
    }
    gapi.load("client:auth2", function () {
        gapi.auth2.init({ client_id: "681860637449-ar2gfuhr23nf88h2ct7b5fs0oh213a0n.apps.googleusercontent.com" });
    });
Here i am facing difficulty regarding This app isn't verified when i try to access other email here are the screen shots for 
1. Consent Screen(URL published) 
2. Gmail Login(Logged in from javascript code) 
3. App not verfified 
1.
Consent Screen
2. Gmail Login
3. App not verified
Not sure if this will help others, but adding http://localhost under "URIs" as below worked for me, on an app marked as Internal through the Google Cloud Console.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With