Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between twitter consumer key and access token

I am following railscasts 235-devise-and-omniauth-revised. The first step is setting up a twitter app credential. I found that there is

Consumer key/Consumer secret

and also

Access token/Access token secret

My question is simple, Why there are two pairs of credential, What's the right scenario to use them.

I noticed here is another same question, which is not help much.

Okay, Then, As far as I know, consumer_key pair is for server. access_key pair is for client. check below comment. Add your answer if you have other understanding.

like image 932
Race Avatar asked Dec 21 '13 15:12

Race


People also ask

What is the difference between a key and a token?

The main distinction between these two is: API keys identify the calling project — the application or site — making the call to an API. Authentication tokens identify a user — the person — that is using the app or site.

What is access token key?

An access token is a tiny piece of code that contains a large amount of data. Information about the user, permissions, groups, and timeframes is embedded within one token that passes from a server to a user's device.


1 Answers

The consumer key is for your application and client tokens are for end users in your application's context.

If you want to call in just the application context, then consumer key is adequate. You'd be rate limited per application and won't be able to access user data that is not public.

With the user token context, you'll be rate limited per token/user, this is desirable if you have several users and need to make more calls than application context rate limiting allows. Your total call capacity (usually per 15 minutes) = number_of_user_tokens X per_user_token_per_api_rate_limit. Also, this way you can access private user data.

Which to use depends on your scenarios.

like image 153
Vishal Avatar answered Oct 01 '22 03:10

Vishal