KentonWhite / zohoho

Simple interface to zoho api
MIT License
8 stars 11 forks source link

auth_tokens and rate limits #2

Closed nolastan closed 12 years ago

nolastan commented 12 years ago

I hit a rate limit in generating auth_tokens. Appears we shouldn't be generating so many. Does anyone know how long the token lives (TTL)? I've been using the same one for about 18 hours now - perhaps they live forever?

I modified the init in my fork to accept an auth_token or username/password, but ultimately the gem should use the same token until (if) it dies, then request a new one.

https://github.com/nolastan/zohoho/blob/master/lib/zohoho/crm.rb

KentonWhite commented 12 years ago

From the developer's forum: (https://forums.zoho.com/topic/attn-api-users-authentication-token-introduced)

"We have changed the implementation of our Developer API, and we now support the Authentication Token for all API calls. This token will become invalid ONLY if you choose to delete it."

So it looks like the token lasts forever. However, one still needs to create a new token for each service one wants to access.

Here is how I see the new flow working.

For a new user create an Authentication Token:

auth_token = Zohoho::Crm.generate_token(email, password)

Then when creating a new instance of the service:

@crm = Zohoho::Crm.new(auth_token)

Thoughts?

nolastan commented 12 years ago

That sounds good.

KentonWhite commented 12 years ago

New authentication token flow implemented.

nolastan commented 12 years ago

Nice work! +1