Android Question Gmail API, not working

Jeremy Tipton

Member
Licensed User
I am new to using API's. I have gone through the OAuth 2.0 tutorial and got that working just fine within a few hours. I can't seem to get the GMail API to work using the provided zip file for the tutorial. I changed the ClientID to my personal code. The only thing else I changed was the address to where the message was being sent. I have ensured the Gmail API is enabled on the developer's console. I set up my key with the correct package name from the manifest file: "b4a.googlecontacts". Is there something else I am missing here? The error I get is a permissions denied, 403 HTTPS error. I can't figure out why on the POST method I keep getting this error when the message is trying to be sent. I reviewed the API and the syntax is all correct from that point of view. I also know the token part of the request is working.

Here is what the log records:
Getting access token from refresh token...
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
Token received. Expires: 03/13/2018 17:05:53
ResponseError. Reason: Forbidden, Response: {
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
Failed to send mail.
Done!!!
 

Attachments

  • mail.zip
    59.7 KB · Views: 201
Last edited:

Jeremy Tipton

Member
Licensed User
Erel,

I did enable the Gmail API in Google. I did not however, update the sHA-1 signature. Does this signature have to be updated for every new project/file you use with the API's? Thank you in advance for helping me figure out a possible problem to check and fix.

Jeremy
 
Upvote 0

Jeremy Tipton

Member
Licensed User
Thank you for your help Erel.

Here is what I did to fix my problem. I made my own "mykeystore.keystore" file using the command prompt and these commands on a Windows computer:
keytool -genkey -dname "CN=Unknown,O=Unknown,C=Unknown" -keystore mykeystore.keystore -keysize 1024 -alias b4a -validity 14000 -keypass 12345

keytool -importkeystore -srckeystore mykeystore.keystore -destkeystore mykeystore.keystore -deststoretype pkcs12

keytool -list -v -keystore {keystore_name path}

I then moved the keystore file into the Objects folder and set the path using the "Private Sign Key" option under the "Tools" menu.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…