@@ -9,7 +9,7 @@ public static IServiceCollection AddOpenApiServices(this IServiceCollection serv
99 {
1010 // Purposely set the spec to a version that is supported by Azure APIM,
1111 // the 'Specs.Generated' output files still use the latest spec versions.
12- options . OpenApiVersion = Microsoft . OpenApi . OpenApiSpecVersion . OpenApi3_0 ;
12+ options . OpenApiVersion = Microsoft . OpenApi . OpenApiSpecVersion . OpenApi3_0 ;
1313
1414 options . AddDocumentTransformer < TransformerDocInfo > ( ) ;
1515 options . AddDocumentTransformer < TransformerComponentSchemas > ( ) ;
@@ -40,10 +40,10 @@ public static void AddOpenApiScalarReference(this IEndpointRouteBuilder app)
4040 options . ClientId = GlobalConfiguration . ApiSettings ! . EntraId . ClientId ;
4141 options . ClientSecret = "fQB8Q~GkKsBaQFKnrTLEGXpRHWejyASJB6ZMGba~" ;
4242 options . CredentialsLocation = CredentialsLocation . Body ;
43- options . SelectedScopes = new List < string >
44- {
43+ options . SelectedScopes =
44+ [
4545 $ "{ GlobalConfiguration . ApiSettings ! . EntraId . ClientId } /.default"
46- } ;
46+ ] ;
4747 } ) ;
4848 options . AddAuthorizationCodeFlow ( "OAuth2" , options =>
4949 {
@@ -52,12 +52,13 @@ public static void AddOpenApiScalarReference(this IEndpointRouteBuilder app)
5252 options . RefreshUrl = $ "https://login.microsoftonline.com/{ GlobalConfiguration . ApiSettings ! . EntraId . TenantId } /oauth2/v2.0/token";
5353 options . ClientId = GlobalConfiguration . ApiSettings ! . EntraId . ClientId ;
5454 options . CredentialsLocation = CredentialsLocation . Body ;
55- options . SelectedScopes = new List < string >
56- {
55+ options . SelectedScopes =
56+ [
5757 $ "{ GlobalConfiguration . ApiSettings ! . EntraId . ClientId } /.default"
58- } ;
58+ ] ;
5959 options . Pkce = Pkce . Sha256 ;
6060 } ) ;
61+ options . AddDefaultScopes ( "OAuth2" , [ $ "{ GlobalConfiguration . ApiSettings ! . EntraId . ClientId } /.default"] ) ;
6162 options . Title = $ "{ GlobalConfiguration . ApiDocument ! . Info . Title } docs | { GlobalConfiguration . ApiDocument . Info . Version } ";
6263 } ) ;
6364 }
0 commit comments