okta-auth-js icon indicating copy to clipboard operation
okta-auth-js copied to clipboard

Adding ability to get rate limit values .

Open SripriyaM opened this issue 6 years ago • 7 comments

Need a solution to retrieve okta rate limit values from response headers

HTTP/1.1 200 Date: Tue, 27 Jan 2018 21:33:25 GMT X-Rate-Limit-Limit: 600 X-Rate-Limit-Remaining: 598 X-Rate-Limit-Reset: 1516308901.

SripriyaM avatar Jul 26 '19 17:07 SripriyaM

@SripriyaM - Thanks for the info!

swiftone avatar Jul 31 '19 21:07 swiftone

@SripriyaM - Sorry, overeager keyboard.

Currently we don't have a low-effort way to expose that info, but we're looking into it. Meanwhile, a work-around is to pass in your own requestor object: https://github.com/okta/okta-auth-js#httprequestclient

You can make this requestor do the work of our request (copy the contents of https://github.com/okta/okta-auth-js/blob/master/fetch/fetchRequest.js along with any reading of the headers you want)

Hope that helps!

swiftone avatar Jul 31 '19 21:07 swiftone

@SripriyaM - As we investigate a better solution - can you clarify which calls you are trying to get the rate limits to? (Obviously how we handle a redirect will be different than whatever call you got the 200 from in your initial report)

Thanks in advance!

swiftone avatar Aug 14 '19 21:08 swiftone

@swiftone - Trying to get the rate limits for calls to /authn,/token,/session,/users(create,list,update,delete,get),/sessions,/oauth2/{authorizationServerId}/v1 API calls .The idea is to see the rate limits usage based on the tables given in https://developer.okta.com/docs/reference/rate-limits/#high-capacity-rate-limits .

SripriyaM avatar Aug 19 '19 10:08 SripriyaM

@swiftone - I have tried the workaround mentioned in above post . It only prints basic header information like "cache-control -> no-cache, no-store content-type -> application/json;charset=UTF-8 expires -> 0 pragma -> no-cache"

and not a full response header(The CORS is enabled on server ) . Since its not getting complete information , i am unable to retrieve rate limit information from response header . Could you kindly advise , if there is another setting i need to do in code or in server configuration.

SripriyaM avatar Aug 26 '19 10:08 SripriyaM

@SripriyaM - The functionality you are asking for doesn't appear to exist in this library at this time - I suggest emailing [email protected] to get in touch with the support staff to see about how best to expose this information and get any issue prioritized.

Sorry I can't be more immediately helpful.

swiftone avatar Aug 28 '19 21:08 swiftone

Internal Ref: OKTA-412511

shuowu avatar Jul 15 '21 16:07 shuowu