Forum Discussion

PockyBuns's avatar
PockyBuns
New Member
2 months ago

Multiple urls for tokenUrl for multiple servers

I have a list of servers like this: 

servers:
- url: https://api.prod.mydomain.com
  description: Production URL
- url: https://api.{environment}.dev.mydomain.com
  description: Environment URL

And would like my securitySchemes for OAuth2 to mention that the tokenUrl will be different depending on the server you use.

Either allow tokenUrl to be a list of urls

securitySchemes: 
      oAuth2:    
        type: oauth2
        description:  'This API is using OAuth 2.0 with password grant type for authentication.'
        flows:
          password:   
            tokenUrl: 
              - https://api.environment.dev.mydomain.com/oauth/token
              - https://api.prod.mydomain.com/oauth/token
            scopes:
              read_pet: read your pets
              write_pet: modify pets in your account

Or to use `server` as a variable like this for the tokenUrl string?

securitySchemes: 
      oAuth2:    
        type: oauth2
        description:  'This API is using OAuth 2.0 with password grant type for authentication.'
        flows:
          password:   
            tokenUrl: {server}/oauth/token
            scopes:
              read_pet: read your pets
              write_pet: modify pets in your account

Does anyone know of a way to do this? 

No RepliesBe the first to reply