cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jimmyg
Level: Powered On

Custom Connector: Defining "Grant Type" for Generic OAuth 2 security

I'm using a Postman v1 file to setup a Custom Connector. My API uses OAuth 2.0 with a username, password, client id, and secret...and requires the "grant type" parameter in the authentication request URL to be set to "password". The specific error message provided by my web server is:

{"error_description":"Missing grant_type parameter value","error":"invalid_request"}

How can I set the grant type to password and define a username & password in Flow for a Custom Connector? This is used by the API as a bearer token has to be included in the authorization header of all API calls.

3 REPLIES 3
Community Support Team
Community Support Team

Re: Custom Connector: Defining "Grant Type" for Generic OAuth 2 security

Hi jimmyg,

 

Have you seen this doc about how to register custom connectors in Microsoft Flow? Please follow the steps in this doc to create the connector:
https://docs.microsoft.com/en-us/flow/register-custom-api

 

Please check your Swagger file and make sure you have specified all the required parameters.


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jimmyg
Level: Powered On

Re: Custom Connector: Defining "Grant Type" for Generic OAuth 2 security

Hi Mabel,

 

I'm using a Postman v1 file, not Swagger. I'm not sure of any way to define this info in the Postman file, but it does work correctly in the Postman app.

 

Based on what you wrote, I created a Swagger v2 file with the following security parameters:

 

  "host": "app1pub.smappee.net",
  "basePath": "/dev/v1",
  "securityDefinitions": {
    "auth": {
      "type": "oauth2",
      "flow": "password",
      "tokenUrl": "https://app1pub.smappee.net/dev/v1/oauth2/token",
      "refreshUrl": "https://app1pub.smappee.net/dev/v1/oauth2/token",
      "scopes": {},
      "x-skip-client-authentication": false
    }

 

When I try to create a custom connector in Flow using this file, I get the following error:

 

The request failed with error: '{"Code":"ValidationError","Message":"One or more fields contain incorrect values:","Target":null,"Details":[{"Message":"One or more fields contain incorrect values:"},{"Code":"ValidationError"},{"ErrorEntity":{"ExtendedCode":"Entity field: apiDefinitionUrl","InnerErrors":[{"Parameters":["contract","apiDefinitionUrl"],"Code":"ValidationError","Message":"Parsing error(s): JSON is valid against more than one schema from 'oneOf'. No valid schemas. Path 'securityDefinitions.auth', line 4789, position 13."}],"Code":"ValidationError","Message":"One or more fields contain incorrect values:"}}],"Innererror":null}'. The tracking Id is '7dd5cf3e-7b8d-4074-a1d5-2bf76e61d7eb'.

Any suggestions for what is going wrong?

 

Thanks,

-Jimmy.

awildash
Level: Powered On

Re: Custom Connector: Defining "Grant Type" for Generic OAuth 2 security

Did you get anywhere with this? I'm having a similar problem where I want to use OAuth2 Client Credentials. Flow has the "Generic Oauth 2" auth type but Oauth2 isnt generic, different flavours require different params.

 

It looks like "Generic OAuth 2" only supports Authroization Code Grant, but I cant find this explicity stated anywhere in the docs.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 350 members 5,085 guests
Please welcome our newest community members: