Connector definition8/27/2023 ![]() Make sure you add the URL to the swagger redirect to your first App Registrations redirect URL’s under authentication. You have to insert the AppId of the Web API App Registration. app.UseSwaggerUI(c =>Ĭ.SwaggerEndpoint("/swagger/v1/swagger.json", "CustomConnectorTest_API v1") Ĭ.OAuthUseBasicAuthenticationWithAccessCodeGrant() This will configure the UI to use OAuth 2.0 so that you are able to authenticate yourself in the swagger ui. You also have to replace line 22 ( app.UseSwaggerUI() ) with the following code snippet. To do so replace line 21 ( app.UseSwagger() ) with the following code. This will make the creation of the custom connector much easier. Since Power Apps only support OpenAPI 2.0 definitions we have to configure the app to output this instead. The current set-up would output the swagger definition in OpenAPI version 3.0. You can find this under “Expose an API” in the first App Registration. You have to add your Tenant ID to the AuthorizationUrl and TokenUrl as well as the Scope URl. (c =>Ĭ.SwaggerDoc("v1", new OpenApiInfo ) Ĭ.AddSecurityDefinition("oauth2", new OpenApiSecuritySchemeĬ.AddSecurityRequirement(new OpenApiSecurityRequirement() Replace line 15 ( () ) with the following block of code. To do so we have to add some lines of code to the Program.cs file. To make swagger work we have to configure it in a way that it is using OAuth 2. It should be the same as what you created while configuring the first App Registration. Second thing to do is to insert the right scope. is) and ClientId (where 11111… is) of the Web API App Registration (the first one we created). You have to insert the TenatId (where 222222…. The following identity settings need to be configuredīefore the project can be successfully executed. Configure AuthenticationĪll we have to do is to add some information to the appsettings.json. It is also important to check the boxes beside “Access tokens (used for implicit flows)” and “ID token (used for implicit and hybrid flows)”.ĭon’t forget to hit “Save” at the top after you have configured everything.Ĭongratulations, you have successfully created your API. Make sure to come back and add the entries then. Some of that information you only get when you created the API, which we will do later in this blog post.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |