cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Custom Connector works with Swagger test, but not on connection test

Hi all

 

I've been trying to connect to an API. Postman works fine and I've manually pieced together a Swagger 2.0 definition of the connection I need to make. When I open the Swagger view and test from there, I get my token and StatusCode 200.

 

 

swagger: '2.0'
info:
  version: '1.0'
  title: BrokerCloud API - Dev
  contact: {}
host: acc.brokercloud.dev
basePath: /oauth/v2
schemes: [https]
consumes: [application/json]
produces: [application/json]
paths:
  /token:
    post:
      summary: POST Token
      tags: [Misc]
      operationId: POSTToken
      deprecated: false
      produces: [application/json]
      consumes: [application/x-www-form-urlencoded]
      parameters:
      - {name: Content-Type, in: header, required: true, type: string, description: '',
        default: application/x-www-form-urlencoded, x-ms-visibility: important}
      - {name: grant_type, in: formData, required: true, type: string, description: '',
        default: password, x-ms-visibility: important}
      - {name: client_id, in: formData, required: true, type: string, description: '',
        default: id, x-ms-visibility: important}
      - {name: client_secret, in: formData, required: true, type: string, description: '',
        default: secret, x-ms-visibility: important}
      - {name: username, in: formData, required: true, type: string, description: '',
        default: user, x-ms-visibility: important}
      - {name: password, in: formData, required: true, type: string, description: '',
        default: pass, x-ms-visibility: important}
      responses:
        '200':
          description: ''
          schema:
            type: object
            properties:
              token_type: {type: string, description: token_type}
              expires_in: {type: integer, format: int32, description: expires_in}
              access_token: {type: string, description: access_token}
              refresh_token: {type: string, description: refresh_token}
        '400':
          description: ''
          schema:
            type: object
            properties:
              error: {type: string, description: error}
              error_description: {type: string, description: error_description}
              hint: {type: string, description: hint}
              message: {type: string, description: message}
      x-ms-visibility: advanced
tags:
- {name: Misc, description: ''}
securityDefinitions: {}

 

 

 

I notice the Swagger encodes the username and password automatically (which is necessary because of special chars).

 

When I save the custom connector and test it however, no such luck. I get StatusCode 400:

 

 

{
  "error": "unsupported_grant_type",
  "error_description": "The authorization grant type is not supported by the authorization server.",
  "hint": "Check that all required parameters have been provided",
  "message": "The authorization grant type is not supported by the authorization server."
}

 

 

 

When I manually encode the username and password, the same thing happens: Code 400.

I'm currently running a Powershell script that does all the necessary modifications but I would like to get this into a Flow. The PS script works perfectly as well.

 

I've been at this for longer than I care to admit and I need some help, I can't make heads or tails of it...

Thank you for any help you can offer.

1 ACCEPTED SOLUTION

Accepted Solutions
Syndicate_Admin
Administrator
Administrator

Update: I've saved the connector regardless of the testing error and when using it in a Flow, it works...

So it seems it is just the interface that does something wonky on the background but when running it it probably just uses the curl.

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Can you please install the paconn CLI tool, download the connector files and post the authentication section?

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

Syndicate_Admin
Administrator
Administrator

Update: I've saved the connector regardless of the testing error and when using it in a Flow, it works...

So it seems it is just the interface that does something wonky on the background but when running it it probably just uses the curl.

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,367)