Skip to content

OAuth2 implicit flow "client_id" field is empty #405

Closed
@marichka-spin

Description

@marichka-spin

Describe the bug
I'm using SpringBoot 2.2 and trying to migrate from springfox 2.9.2 to springdoc-openapi. We use OAuth2 security Scheme. I'm trying to setup swagger ui to be able to go through implicit login flow.
But "client_id" property on auth dialog is empty and I need it filled with correct clientId.
My code to setup OpenAPI:

@Bean
  public OpenAPI customOpenAPI() {
    String authorizeUrl = String.format(
        "https://login.microsoftonline.com/%s/oauth2/v2.0/authorize", tenantId);
    Scopes scopes = new Scopes();
    scopes.addString(apiScope, "Access API");
    OAuthFlow oAuthFlow = new OAuthFlow();
    oAuthFlow.authorizationUrl(authorizeUrl);
    oAuthFlow.setScopes(scopes);
    return new OpenAPI()
        .components(
            new Components()
                .addSecuritySchemes("oauth", new SecurityScheme()
                    .type(Type.OAUTH2)
                    .in(In.HEADER)
                    .bearerFormat("jwt")
                    .flows(
                        new OAuthFlows().implicit(oAuthFlow)
                )
        )));
  }

My application.pproperties
springdoc.swagger-ui.oauth.clientId=some client id
springdoc.swagger-ui.oauth.clientSecret=some client secret

Expected result
field "client_id" is populated with springdoc.swagger-ui.oauth.clientId value
Screenshot from 2020-02-05 17-48-41

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions