Dynamic Quota for API Product while using OAuthV2

While searching quota for API Product I came across lot of posts using VerifyAPIKey policy.

Is same can be implemented by use of OauthV2?

<Allow count="5" countRef="oauthv2.verify-oauth.apiproduct.developer.quota.limit"/>
    <Interval ref="oauthv2.verify-oauth.apiproduct.developer.quota.interval">1</Interval>
    <TimeUnit ref="oauthv2.verify-oauth.apiproduct.developer.quota.timeunit">minute</TimeUnit>

I have defined quota in API Product, still taking quota 5, not product configuration

Solved Solved
0 2 160
1 ACCEPTED SOLUTION

Yes, it is possible.

Maddeningly, the variables that hold quota information are different, depending on whether you use VerifyApiKey or OAuthV2/VerifyAccessToken.

Quota following VerifyApiKey:

<Quota name='Quota-1'>
    <Identifier ref='${1:request.queryparam.apikey}' />
    <Allow countRef='verifyapikey.POLICYNAME.apiproduct.developer.quota.limit' count='1000'/>
    <Interval ref='verifyapikey.POLICYNAME.apiproduct.developer.quota.interval'>1</Interval>
    <TimeUnit ref='verifyapikey.POLICYNAME.apiproduct.developer.quota.timeunit'/>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
    <PreciseAtSecondsLevel>false</PreciseAtSecondsLevel>
</Quota>

Quota following OAuthV2/VerifyAccessToken:

<Quota name='Quota-1'>
    <!-- use the client_id that is set after OAuthV2/VerifyAPIKey -->
    <Identifier ref='client_id' />
    <Allow countRef='apiproduct.developer.quota.limit' count='1000'/>
    <Interval ref='apiproduct.developer.quota.interval'>1</Interval>
    <TimeUnit ref='apiproduct.developer.quota.timeunit'/>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
    <PreciseAtSecondsLevel>false</PreciseAtSecondsLevel>
</Quota>

View solution in original post

2 REPLIES 2

Yes, it is possible.

Maddeningly, the variables that hold quota information are different, depending on whether you use VerifyApiKey or OAuthV2/VerifyAccessToken.

Quota following VerifyApiKey:

<Quota name='Quota-1'>
    <Identifier ref='${1:request.queryparam.apikey}' />
    <Allow countRef='verifyapikey.POLICYNAME.apiproduct.developer.quota.limit' count='1000'/>
    <Interval ref='verifyapikey.POLICYNAME.apiproduct.developer.quota.interval'>1</Interval>
    <TimeUnit ref='verifyapikey.POLICYNAME.apiproduct.developer.quota.timeunit'/>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
    <PreciseAtSecondsLevel>false</PreciseAtSecondsLevel>
</Quota>

Quota following OAuthV2/VerifyAccessToken:

<Quota name='Quota-1'>
    <!-- use the client_id that is set after OAuthV2/VerifyAPIKey -->
    <Identifier ref='client_id' />
    <Allow countRef='apiproduct.developer.quota.limit' count='1000'/>
    <Interval ref='apiproduct.developer.quota.interval'>1</Interval>
    <TimeUnit ref='apiproduct.developer.quota.timeunit'/>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
    <PreciseAtSecondsLevel>false</PreciseAtSecondsLevel>
</Quota>

Thanks Dino, it worked
Tracing helped to identify the variables you listed above