cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinBurman
Frequent Visitor

Using OpenAPI definition to register a custom connector implementing OAuth2 with grant-type application inconsistencies and error.

Hello,

 

I tried to cram the whole situation into the title.

 

When using an OpenAPI definition apiProperties.json with

"securityDefinitions": {
    "OAuth2": {
      "type": "oauth2",
      "description": "OAuth2 Client Credentials",
      "flow": "application",
      "tokenUrl": "https://login.vendor.com/as/token.oauth2",
      "scopes": {
        "scopedtothis": "Read access to protected resources"
      }
    }
  

I get through the first validation when i am prompted to import my OpenAPI definition. If you dont have a valid schema then you get stopped here is my experience.

first image

However, when registering additional information under Security i am forced to enter all the fields although i dont need them (is my understanding). Fields such as Refresh URL and Authorization URL. As i am using grant-type application (Which is part of OpenAPI 2.0) i do not require an Authorization URL (source). Im inlcuding these sources so that we have some common ground when discussing this. Everything i've stated above is how i've understood things after reading documentations for a few hours today.

 

And at last the reason im making this post is because i get an error message when trying to register my custom connector implementing OAuth2error

 

What im trying to achieve is working in postman with the following settings for acquiring a token.

69Gt7ER

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @MartinBurman ,

Which service do you use as the OAuth 2.0 Identify Provider?

Could you please share a bit more about the grant-type application that you mentioned?

 

Based on the issue that you mentioned, I think this issue may be related to the Grant-Type you used as authentication way on your side.

 

Currently, within PowerApps/Microsoft Flow, if you use OAuth 2.0 as authentication way within your custom connector, actually, it would use Authorization Code as the Grant Type rather than Client Credentials.5.JPG

 

If you want to use OAuth 2.0 as authentication way within your custom connector, and use Client Credentials as Grant Type, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, you could consider use API Key as Authentication way within your custom connector. Please take a try with the following workaround:

1. Specify "API Key" as Authentication way within your custom connector.6.JPG

2. Generate an Access Token using Postman (just as you mentioned).

3. Save your custom connector. Go to the "Test" tab in your custom connector, click "New connection", type the following value within the Authorization box:

Bearer Access_Token

7.JPG

Note: The Access_Token represents the Access Token you get from the Step 2. The sample format as below:

Bearer 02989e924bb6245305b13446d6fdfba2af710bad

There is a space between the Bearer and the Access Token value.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

try to set the right setting

 

i think azure ad in your case

2019-07-24 16_38_52-.png

v-xida-msft
Community Support
Community Support

Hi @MartinBurman ,

Which service do you use as the OAuth 2.0 Identify Provider?

Could you please share a bit more about the grant-type application that you mentioned?

 

Based on the issue that you mentioned, I think this issue may be related to the Grant-Type you used as authentication way on your side.

 

Currently, within PowerApps/Microsoft Flow, if you use OAuth 2.0 as authentication way within your custom connector, actually, it would use Authorization Code as the Grant Type rather than Client Credentials.5.JPG

 

If you want to use OAuth 2.0 as authentication way within your custom connector, and use Client Credentials as Grant Type, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, you could consider use API Key as Authentication way within your custom connector. Please take a try with the following workaround:

1. Specify "API Key" as Authentication way within your custom connector.6.JPG

2. Generate an Access Token using Postman (just as you mentioned).

3. Save your custom connector. Go to the "Test" tab in your custom connector, click "New connection", type the following value within the Authorization box:

Bearer Access_Token

7.JPG

Note: The Access_Token represents the Access Token you get from the Step 2. The sample format as below:

Bearer 02989e924bb6245305b13446d6fdfba2af710bad

There is a space between the Bearer and the Access Token value.

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you for the extensive respone.

 

That could be an option, and then to also add a separate connector for getting the token in a productionenvironment.

 

I will mark you answer as a solution since this is not really a part of the original question any more and i think others will find it useful to read our conversation here.

Martin

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (46,849)