oauth2Client

Version

Obtains an OAuth2 access token using the client credentials flow and forwards the request with a Bearer token.

Example Configuration

api:
port: 2000
flow:
- oauth2Client:
tokenUrl: https://auth.example.com/oauth2/token
clientId: gateway
clientSecret: secret
scope: read write
target:
url: https://api.example.com
api:
   port: 2000
   flow:
     - oauth2Client:
         tokenUrl: https://auth.example.com/oauth2/token
         clientId: gateway
         clientSecret: secret
         scope: read write
   target:
     url: https://api.example.com

Syntax

oauth2Client:
clientId: <string> # required
clientSecret: <string> # required
tokenUrl: <string> # required
scope: <string>
oauth2Client:
  clientId: <string> # required
  clientSecret: <string> # required
  tokenUrl: <string> # required
  scope: <string>

Attributes

NameRequiredDefaultDescriptionExamples
clientIdtrue-The OAuth2 client id used for the token request.gateway
clientSecrettrue-The OAuth2 client secret used for the token request.secret
scopefalse-Space-separated scopes requested for the access token.read write
tokenUrltrue-The token endpoint used to obtain the OAuth2 access token.https://auth.example.com/oauth2/token

Can be used in