cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jimmyg
New Member

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
Community Support

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
New Member

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
Frequent Visitor

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

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (8,249)