Custom query parameter in oauth_2_0 security scheme


#1

Hi,

I would like to pass custom query parameter in oauth_2_0 security scheme (authorization URI),

for example,

securitySchemes:
[...]
settings:
        authorizationUri: https://api.mydomain.com/forms/authorise-client?locale=en-GB
        accessTokenUri: https://api.mydomain.com/v2/customer-api/customers/auth
        authorizationGrants: [ code ]

Note the “locale” in the authorization URI.

Is there a way to do that?

Thank you,
Arun


#2

This is a very good question, I could not find a “clean” way to define this except by creating another security Scheme (which probably you already did).

securitySchemes:
  - myoauth_GB:
      type:  OAuth 2.0
      settings:
        authorizationUri: https://api.mydomain.com/forms/authorise-client?locale=en-GB
        accessTokenUri: https://api.mydomain.com/v2/customer-api/customers/auth
  - myoauth_US:
      type:  OAuth 2.0
      settings:
        authorizationUri: https://api.mydomain.com/forms/authorise-client?locale=en-US
        accessTokenUri: https://api.mydomain.com/v2/customer-api/customers/auth       

It would be nice to have queryparameters and uriparameters support on every element in the RAML spec where you could use an URL.


#3

Hi Luix,

Thanks for getting back to me.

My issue is I am not able to specify a “locale” in the authorizationUri, as the RAML spec seems to assume that there will be no customer query parameters added.
So for example with the above authorizationUri re-directs the customer to the below URI.
Can you see the two question marks (?) there.

https://api.mydomain.com/forms/authorise-client?locale=en-GB?client_id=AA1234&response_type=code&redirect_uri=http://api-portal.anypoint.mulesoft.com/raml/api-designerauthentication/oauth2.html

Thanks,
Arun