我正在尝试使用Gmail API javascript代码访问其他电子邮件,代码如下:-
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" });
});
当我尝试访问其他电子邮件时,这里遇到有关此应用未通过验证的问题,这是
的屏幕截图
1.同意屏幕(已发布网址)
2. Gmail登录(使用javascript代码登录)
3.应用未通过验证
1。
Consent Screen
2。 Gmail Login
3。 App not verified