Skip to content

What is the recommended way to swap OAuth2 token with an API token? #6286

Open
@CodyBatt

Description

@CodyBatt

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Firefox
  • Version: 79
  • Method of installation: Asp.Net Swashbuckle
  • Swagger-UI version: ?
  • Swagger/OpenAPI version: OpenAPI 3

How can we help?

I need to exchange an Oauth2 token from an STS for an API token provided by my API. This is done by making an API request passing the Oauth2 token and my API returns a new Bearer token that should be specified in API requests. I'm trying to integrate this into Swagger UI. I have configured it to get the Oauth2 token ("implicit" flow) and that's working fine. I'm just not sure what the best way is to then do the token exchange and replace the Bearer token returned from Oauth2 with the API token for all future "Try it Out" requests. What would you suggest for this?

The documentation says that the requestInterceptor should be called for Oauth2 requests and that seems to be the perfect spot, but my requestInterceptor is only getting called for "Try it Out" requests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions