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

Precondition check failed error using Gmail API v1

  • 1.  Precondition check failed error using Gmail API v1

    Posted 08-27-2020 23:55
    Does anyone get it to work?  I get the following error to use gmail.users.messages.list or gmail.users.messages.read.

    Internal : Unexpected error Error during Web API HTTP Request
    HTTP Status Code: 400
    HTTP Response Content: {
    "error": {
    "code": 400,
    "message": "Precondition check failed.",
    "errors": [
    {
    "message": "Precondition check failed.",
    "domain": "global",
    "reason": "failedPrecondition"
    }
    ],
    "status": "FAILED_PRECONDITION"
    }
    }

    ------------------------------
    Steven Cheng
    IT Application Advisor
    Celestica Inc.
    America/Toronto
    ------------------------------


  • 2.  RE: Precondition check failed error using Gmail API v1

    Posted 08-28-2020 14:45
    Hi, Steven,

    you are lucky guy ;) as I just solved it after 3 almost full days of investigation this morning.

    My understanding is following:
    1. you need to have G Suite account activated (if you don't have it you can activate it for 14 days for free). So to state it clearly - this will not work for personal gmail account - as long as you are going to use service account.
    2. if first step done you need to perform all the steps which are found here https://developers.google.com/admin-sdk/directory/v1/guides/delegation
    3. when you import bpskill you need to follow the guide for configuration
    4. when all configurations are done you need to change properties of the Common Authentication parameters in Authorization URI and Audience like in the image below. The scope and subject depends on your environment and requirement.
    4. after that it should work, at least it worked for me  

    Google JWT Credentials


    ------------------------------
    Zdeněk Kabátek
    Head of Professional Services
    NEOOPS
    http://www.neoops.com/
    Europe/Prague
    ------------------------------



  • 3.  RE: Precondition check failed error using Gmail API v1

    Posted 08-29-2020 00:00
    Changing the Common Authentication definition should not be required, at least it wasn't for me. However, as Zdeněk mentioned, you will have to have a company deployment of G-Suite to test this using a Google Service Account. That means you will also have to have a domain name that you can tie to the G-Suite configuration.

    I did continue to receive the 400 error for quite a while after setting up my G-Suite though. I ended up restarting my Blue Prism client a few times and then things started working correctly. Not sure if that was an issue of something having been cached from the initial failed attempts or what. 
     
    Cheers,
     


    ------------------------------
    Eric Wilson
    Director, Partner Integrations for Digital Exchange
    Blue Prism
    ------------------------------



  • 4.  RE: Precondition check failed error using Gmail API v1

    Posted 08-29-2020 01:13
    It looks like I spoke to soon. 😭 You do have to set the value of Subject on the Common Authentication page. However, instead of hard coding the value you can set it to the value of the userId input parameter that is required on every method. What this ends up doing is telling Google which specific user the service account is requesting delegated authority for. Here's what my Common Authentication section looks like:



    ------------------------------
    Eric Wilson
    Director, Partner Integrations for Digital Exchange
    Blue Prism
    ------------------------------



  • 5.  RE: Precondition check failed error using Gmail API v1

    Posted 09-03-2020 16:03
    Hi Zdeněk: I am trying to automate GMail API using the Skill from DX. Can you help me to share any specific guide from Blueprism to perform the list of configurations. I am trying to send my private KEY in Credentials using getProfile action. I am getting error like below.

    Internal : Unexpected error PKCS8 data must be contained within '-----BEGIN PRIVATE KEY-----' and '-----END PRIVATE KEY-----'. I tried multiple approach to send the KEY in credential manager in the below format but I am getting same error. Would you able to guide me for this error.

    Approach 1: '-----BEGIN PRIVATE KEY-----' myPrivatekey '-----END PRIVATE KEY-----'


    ------------------------------
    Arthanareeswaran Chandrasekaran
    Technical Lead/ Architect
    IBM
    Asia/Singapore
    ------------------------------



  • 6.  RE: Precondition check failed error using Gmail API v1

    Posted 09-03-2020 16:32
    Hi @Arthanareeswaran Chandrasekaran​,

    What do yo mean you're using the getProfile action? If you're using the GMail skill from the DX you configure the credential details in Settings -> Security -> Credentials. Enter your Issuer and Private Key information there and then reference that credential within the GMail skill definition on the Common Authentication page.

    Cheers,

    ------------------------------
    Eric Wilson
    Director, Partner Integrations for Digital Exchange
    Blue Prism
    ------------------------------



  • 7.  RE: Precondition check failed error using Gmail API v1

    Posted 09-03-2020 16:53
      |   view attached
    Hi @Eric Wilson: Thanks for responding. I have updated my API KEY in Credentials under "Google OAuth2 JWT Credential" in below format

    '----- BEGIN PRIVATE KEY -----'\n AIza---kuE \n'----- END PRIVATE KEY -----'\n. While Executing getprofile I am getting below error. Can you help me with the exact format to be used for updating the key in credentials. I tried multiple approach but still no luck.

    Error Message: "Internal : Unexpected error PKCS8 data must be contained within '-----BEGIN PRIVATE KEY-----' and '-----END PRIVATE KEY-----'.
    Parameter name: privateKey".

    Attaching the screen shot for your reference from the common authentication. Thanks once agiain for your support.





    ------------------------------
    Arthanareeswaran Chandrasekaran
    Technical Lead/ Architect
    IBM
    Asia/Singapore
    ------------------------------