Solved

How do I build a custom connector for Power Automate?

  • 13 September 2021
  • 6 replies
  • 644 views

Hi,

I’ve been trying to build a custom connector from Powerautomate and it is not authenticating me. I have tried both Post authentification using Json as well as OAuth2.9 from Postman and they were both successful. 

Issue #1:
I’ve tried the api key authentication but don’t know where to find the API key for acumatica? Can someone let me know where to find it please?

Issue #2: 

In lieu of the API Key authentication, I tried OAuth2.0 but keep getting the error: 
“The client application is not known or is not authorized”

Can you please confirm that my URLS are correct, I need the following fields:

Host: Host.acumatica.com

Client id: generated in acumatica under connected application

Client Secret: generated in acumatica under connected application

Authorization URL: https://Host.acumatica.com/identity/connect/authorize

Token URL: https://Host.acumatica.com/identity/connect/token

Refresh URL: https://Host.acumatica.com/identity/connect/token

Scope: api

icon

Best answer by brenthitterdal 14 April 2022, 02:39

View original

6 replies

Userlevel 4
Badge

Hi @ekermani

 

While I have not used Power Automate, I’m happy to share a workflow process we have had success with using Zappier. 

 

First, we set the Acumatica side Connected Applications OAuth 2.0 Flow to ‘Resource Owner Password Credentials’ and generate a Shared Secret.

 

 

Next, call the ‘Token URL’ you mentioned in your post, passing the following in the request body in an x-www-form-urlencoded format:

  • grant_type: ‘password’
  • client_id: <The Client ID of your Connected Applications entry in Acumatica>
  • client_secret: <The Shared Secret>
  • username: <An Acumatica Username>
  • password: <The password for the above Acumatica username>
  • scope: ‘api’

 

If the setup is good, you will get a response that looks like this:

 

 

Now that you have the access_token, you can use it to send your follow up requests to Acumatica.  You can do this by adding the following to your request headers:

Authorization: Bearer <your access token>

 

 

More information can be found here under the ‘Authorizing Client Applications to Work with Acumatica ERP’ section:

https://www.acumatica.com/media/2020/02/AcumaticaERP_IntegrationDevelopmentGuide.pdf

 

Hi Stephen, 
Thank you for your response. I did eventually figure out the OAuth2 from power automate to Acumatica but the parameters that Powerautomate sends acumatica for authentication is different and not in the correct format. 
see below:

 

Authorization Code Flow sample:

https://localhost/AcumaticaDB/identity/connect/authorize?

response_type=code

&client_id=4B1DFD71-C5EE-0B21-A6BE-9A1F060A93BD

&redirect_uri=http%3A%2F%2Flocalhost%2Fclientapp%2F

&scope=api%20offline_access

 

 

What powerautomate sends: 

Invalid flow for client: AuthorizationCode

{

  "ClientId": "******************************************************************t",

  "ClientName": "Postman2",

  "RedirectUri": "https://global.consent.azure-apim.net/redirect",

  "AllowedRedirectUris": [

    "https://global.consent.azure-apim.net/redirect"

  ],

  "SubjectId": "unknown",

  "ResponseType": "code",

  "ResponseMode": "query",

  "Flow": "AuthorizationCode",

  "RequestedScopes": "",

  "State": "*************************************************_unitedstates-002_azure-apim.net",

  "Raw": {

    "client_id": "****************************************************",

    "response_type": "code",

    "redirect_uri": "https://global.consent.azure-apim.net/redirect",

    "scope": "api offline_access",

    "state": "******************************_unitedstates-002_azure-apim.net"

  }

 

 

Can you suggest a method to go around this? Thank you

Userlevel 6
Badge +1

Were you able to get this working? I’m also interested in this.

Hello - I am also interested in this if anyone has been able to successfully authenticate and maintain a connection from PowerAutomate to Acumatica.

We were able to get this working - here are the steps we used in a blog post:

https://najaxasoftware.com/connect-to-acumatica-rest-api-with-power-automate/

Userlevel 2
Badge

@brenthitterdal , @ekermani , @stephenbologna39  Howdy! Great collection of information. FYI, I’m just diving into this. I’ll keep you posted on how I make out ;-)

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved