Digital Exchange

 View Only
last person joined: 2 days ago 

This community is a place to discuss Blue Prism DX assets and development.

Expand all | Collapse all

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

Jump to Best Answer
  • 1.  Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-17-2022 10:30
    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



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

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


  • 2.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-18-2022 00:10
    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
    ------------------------------



  • 3.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-18-2022 04:32
    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

    Regards,

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



  • 4.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.
    Best Answer

    Posted 03-20-2022 20:18
    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
    ------------------------------



  • 5.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-21-2022 09:28
    Hi @Eric Wilson,

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

    Best Regards,

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



  • 6.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-22-2022 22:24
    @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
    ------------------------------



  • 7.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-23-2022 04:03
    @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
    ------------------------------



  • 8.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-23-2022 09:46
    @Eric Wilson

    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:

    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.


    These are the inputs that I have provided.

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



  • 9.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-23-2022 14:03
    @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
    ------------------------------



  • 10.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-24-2022 10:09
    @Eric Wilson

    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?


    Best Regards,​

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



  • 11.  RE: Gmail API vbo throws exception - invalid base 64 character or invalid padding.

    Posted 03-24-2022 10:54
    @Jeevan R,

    Is that your actual private key value?​ If so, it's invalid. That' way to short for a Google private key. To answer your question though, the way I typically handle the credential is by making use of Credential Manager. Here's an example:

    Regarding your private key value, all you have to do is pull that out of the JSON-encoded credential file that Google makes available when you create the credential in the Google Console.

    My private key value, from the first "-" to the trailing "\n" is 1732 characters long. You take those two values (client_email and private_key) and use them to populate your Blue Prism Credential Manager entry.

    After I have the client_email and private_key values, I create a JWT Bearer token definition in Credential Manager. In reality, you could create a regular General credential if you wanted to now that the authentication will be handled by the new VBO. You just need a Username and Password value.

    Next, in my process, I'll use the native Credential VBO to get the Username and Password value based on the name of the credential.

    After that, I call the Google Cloud - Authentication VBO's Get Service Account Token action and pass in the Username, Password, my scopes, and the delegated user email address.


    From that, I should receive a valid access token. The access token should be about 208'ish characters long. Hint: If the token is longer, and contains a bunch of periods at the end, it's not a valid token.

    Cheers,

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



Welcome to the Blue Prism Digital Exchange Community!

The Blue Prism Digital Exchange is a "shop window" for new and emerging technologies—a platform that puts powerful RPA and AI capabilities into the hands of business leaders. Users can find and apply pre-built AI capabilities, in the form of downloadable integrations and Visual Business Objects (VBOs), to automated processes. These assets connect and integrate Digital Workers, existing systems and processes to Blue Prism's technology partners, creating a solid foundation of AI-enabled Intelligent Automation that's scalable and sustainable.

Blue Prism Digital ExchangeDX Asset IdeasContact DX Support

FAQs

The Blue Prism Digital Exchange (DX) is an online marketplace where businesses can instantly access, apply and share pre-built AI, cognitive and advanced RPA technologies from best-in-class providers. These assets easily connect to existing digital workers, systems and processes to enhance automation capabilities.
The Digital Exchange is free to all users. Most of the content on the DX is free to download but there are some submissions that do have a cost associated. The submissions with a cost are advertised on the asset card and profile. No unwanted costs will be applied to any users.
You can visit and browse the Digital Exchange here. If you would like to consume or download any material it is necessary to create an account on the Blue Prism Portal first.
Everyone can access the Digital Exchange and consume the assets on it. If you would like to contribute to the marketplace it is necessary that you create an account and sign up as a partner.