Twitter Connect 转载自 Twitter 官方 Wiki
![]()
Sign in with Twitter is the pattern of authentication that allows users to connect their Twitter account with third-party services in as little is one click. It utilizes OAuth and although the flow is very similar, the authorization URL and workflow differs slightly as described below.
The normal flow dictates that applications send request tokens to oauth/authorize in Twitter’s implementation of the OAuth Specification. To take advantage of Sign in with Twitter, applications should send request tokens in the oauth_token parameter to oauth/authenticate instead.
The oauth/authenticate method will perform the following:
- If the user is logged into Twitter.com and has already approved the calling application, the user will be immediately authenticated and returned to the callback URL.
- If the user is not logged into Twitter.com and has already approved the calling application, the user will be prompted to login to Twitter.com then will be immediately authenticated and returned to the callback URL.
- If the user is logged into Twitter.com and has not already approved the calling application, the OAuth authorization prompt will be presented. Authorizing users will then be redirected to the callback URL.
- If the user is not logged into Twitter.com and has not already approved the calling application, the user will be prompted to login to Twitter.com then will be presented the authorization prompt before redirecting back to the callback URL.
This behavior is explained in the following flowchart:

Sign in with Twitter Buttons
Twitter would prefer your application to use the following buttons. While it is easy roll your own buttons or create text links, using these standard buttons will instill user confidence and standardize the experience.
Darker


Lighter


Peter Denton has also created a number of buttons to make this experience easy and beautiful.