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: "/ pose .modify .readonly" })
.then(function () { console.log("Sign-in successful"); },
function (err) { console.error("Error signing in", err); });
}
function loadClient() {
return gapi.client.load("")
.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 plete 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" });
});
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
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./ https://www.googleapis./auth/gmail.pose https://www.googleapis./auth/gmail.modify https://www.googleapis./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./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 plete 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." });
});
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
- Have you checked this SO post solution offered by DaImTo regarding Gmail API Google OAuth on how to get the app verified? Starting July 18, 2017, Google OAuth clients that request certain sensitive OAuth scopes will be subject to review by Google. Here's also a supporting documentation about Unverified Apps. – Jessica Rodriguez Commented Mar 13, 2019 at 14:22
- But it still does not help as consent screen does not accept local host. I have searched all over stack over flow and the net still can't find the solution as there is no accurate solution to test local host gmail api. – namco Commented Mar 24, 2019 at 18:19
- So @namco did you resolve this? – nullwriter Commented May 3, 2019 at 16:15
- @nullwriter not resolved yet .. as found out you need to have some things purchased in order to do so business suite some sort i suppose. – namco Commented Oct 19, 2019 at 17:27
1 Answer
Reset to default 3Not 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 your app is not "internal", you will have to go through a manual verification step from what I have read - don't know anything about this, my app is internal
- To get around the localhost issue, adding the host to the Credentials config as opposed to the OAuth2 consent screen config seems to have worked for me, at least with my web app on localhost retrieving a Google Sheet (config not intuitive because the domain validations differ between the two GCP settings pages):
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744716187a4589632.html
评论列表(0条)