cancel
Showing results for 
Search instead for 
Did you mean: 

Gmail API vbo throws exception - invalid base 64 character or invalid padding.

JeevanR
Level 5
Hello Community,

I am trying to get mails from Gmail through an API connector which is there in digital exchange, I have created the project in google cloud platform, enabled the Gmail API, created O-Auth credentials and service account as pre-requisites.

I have imported the Gmail API VBO and set the key in the credential manager, I am getting this error when I execute the process

"Internal : Unexpected error The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "

I request your help on resolving this, I have attached the screenshot  below, 

Please let me know if you require any more information.

Regards,
Jeevan

6630.png

------------------------------
Jeevan R
------------------------------

------------------------------
Jeevan R
------------------------------
Jeevan Rangaraju - AD01 Certified RPA Professional Associate Consultant Ernst & Young LLP Bangalore, India Email - jjeevan152@gmail.com
1 BEST ANSWER

Best Answers

Hi @Jeevan R,

I haven't tested this in v7, but in v6.10.4 I was able to recreate your specific error by trying to build my own JWT and singing it with the private key without normalizing the format of the private key value. What I mean by that is the format Google provides the key in actually Unix-focused. That's because the newlines used in the key definition are just \n whereas a newline in Windows is actually \r\n.

It could be that something was broken in the v7 codebase because previously the Web API feature properly handled the normalization of the private key (PKCS #8) into the correct PEM base 64 format.

So, as I've been looking over this I decided there are some things we can do to improve this overall (regardless of what the possible issue is in v7). We're are working on a new release of the GMail API v1 connector that will remove the native authentication handling within the Web API. We're going to implement it directly using the Google APIs Auth library. That will give you a VBO dedicated to handling the authentication/authorization and returning the needed token.

We should have this new implementation finished this week and, hopefully, posted to the DX by the end of the week.

Cheers,
   
​​​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

View answer in original post

10 REPLIES 10

ewilson
Staff
Staff
Hello @Jeevan R,

​What actions on the GMail connector are you trying to execute?

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Eric Wilson,

Thanks for the response, for your information I am using get messages using the gmail connector, i have done all the pre-requisites i am facing the error which is attached above, i think this is because of invalid character in credentials, below is the screenshot of credential configuration, please let me know if you need any more information.
-----BEGIN PRIVATE KEY-----\n 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 \n-----END PRIVATE KEY-----\n
6579.png
Regards,

------------------------------
Jeevan R
------------------------------
Jeevan Rangaraju - AD01 Certified RPA Professional Associate Consultant Ernst & Young LLP Bangalore, India Email - jjeevan152@gmail.com

Hi @Jeevan R,

I haven't tested this in v7, but in v6.10.4 I was able to recreate your specific error by trying to build my own JWT and singing it with the private key without normalizing the format of the private key value. What I mean by that is the format Google provides the key in actually Unix-focused. That's because the newlines used in the key definition are just \n whereas a newline in Windows is actually \r\n.

It could be that something was broken in the v7 codebase because previously the Web API feature properly handled the normalization of the private key (PKCS #8) into the correct PEM base 64 format.

So, as I've been looking over this I decided there are some things we can do to improve this overall (regardless of what the possible issue is in v7). We're are working on a new release of the GMail API v1 connector that will remove the native authentication handling within the Web API. We're going to implement it directly using the Google APIs Auth library. That will give you a VBO dedicated to handling the authentication/authorization and returning the needed token.

We should have this new implementation finished this week and, hopefully, posted to the DX by the end of the week.

Cheers,
   
​​​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @ewilson,

Thanks for the valuable response, ​hope to see the latest version in DX ASAP.

Best Regards,

------------------------------
Jeevan R
------------------------------
Jeevan Rangaraju - AD01 Certified RPA Professional Associate Consultant Ernst & Young LLP Bangalore, India Email - jjeevan152@gmail.com

@Jeevan R,

The updated GMail API v1 - 1.1.1 connector and new Google Cloud - Authentication VBO have been posted to the DX.​ I HIGHLY recommend that you remove the existing skill before installing the newer v1.1.1 .bprelease. 

The new connector is only a WebAPI service definition. There is no longer a Blue Prism skill attached to it. This makes it easier to customize the connector in your own environment if necessary.

To work with the new connector, you need to first make an authentication request using the Google Cloud - Authentication VBO to get your service account access token. Once you have the token you can pass it into your calls to the new GMail API v1 connector.

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

@Jeevan R,

One other thing I forgot to mention. Creating a message in GMail, via the REST API, is a little complex as the REST API expects you to be working at the base 64 encoded MIME message level. Because of that, I'm working on a small helper VBO that will allow you to input the basic information of an email (ex. To, From, Subject, Body, and Attachments) and it will create the raw message data for you. Then all you have to do is pass it along into the GMail API.

I should have that ready in the next day or two.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

@ewilson

Thank you for the response,

I installed the latest version of Gmail API and also installed ​the google cloud authentication, still I am facing the same error I have attached the screenshot:
6599.png
Please help me resolve this error

-----BEGIN PRIVATE KEY-----\n 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 \n-----END PRIVATE KEY-----\n

I have provided the password in the above format.

6600.png
These are the inputs that I have provided.

------------------------------
Jeevan R
------------------------------
Jeevan Rangaraju - AD01 Certified RPA Professional Associate Consultant Ernst & Young LLP Bangalore, India Email - jjeevan152@gmail.com

@Jeevan R,

Try adding a user email to the ​Delegated User input. Even though you're using a service account, GMail seems to be one of those services where Google expects you to work on behalf of a specific user. The user account you would enter there would be whatever user email you expect to send/receive emails with.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

@ewilson

I have provided the Delegated user and still, I get the same error is this the proper way of providing the credentials and does BP 7.0 support this version of the API?
6614.png

Best Regards,​

------------------------------
Jeevan R
------------------------------
Jeevan Rangaraju - AD01 Certified RPA Professional Associate Consultant Ernst & Young LLP Bangalore, India Email - jjeevan152@gmail.com