Jump to content

API Validating Auth Token Expiration


FASTDEVICE

Recommended Posts

I'm almost never accused of doing something the "new fangled" way. I need to take this in for a minute...
....
......
Wait For It
..........
.............
Awww yea, that's nice. ;)

Gun to my head, I'd use v1/accounts/{account_id}/webhooks. First, if you are relying upon webhooks for other parts of your app, you can double check it and make sure they are still there whit this data. So, at least it wouldn't be a totally wasteful request. Second, I don't think very many people even use this feature. So, most accounts will probably be empty. Those that do use the webhooks should only have a couple. So, in any scenario it should be a pretty small request.

I'd still assume the token's good for some length of time. At least a minute or two. Can't imagine checking it before every single API call.

The best docs I've found are here: https://github.com/2600hz/kazoo/tree/master/applications/crossbar/doc
Maybe you can find something that works better for you. I don't see any functions that simply validate a token or return static data though.
Link to comment
Share on other sites

  • 2 weeks later...
Guest CBV David
You can validate if the auth_token is not expired:

Fetch Token auth information
GET /v2/accounts/{ACCOUNT_ID}/user_auth/{AUTH_TOKEN}
Doesn't appear that any sort of time to expire information is included in the response.

Presumably you've already found this from Rick's link above, but just in case you hadn't: https://github.com/2600hz/kazoo/blob/master/applications/crossbar/doc/user_authentication.md

I believe that on the hosted cluster tokens are currently set to expire after an hour, but you'd probably want to confirm that to be certain.
Link to comment
Share on other sites

×
×
  • Create New...