[−][src]Function egg_mode::access_token
pub fn access_token<S: Into<String>>(
con_token: KeyPair,
request_token: &KeyPair,
verifier: S
) -> AuthFuture
With the given OAuth tokens and verifier, ask Twitter for an access KeyPair that can be used to sign further requests to the Twitter API.
Access Token Authentication
- Request Token: Authenticate your application
- Authorize/Authenticate: Authenticate the user
- Access Token: Combine the authentication
Access Token: Combine the app and user authentication
This is the final step in authenticating a user account to use your app. With this method, you
combine the consumer KeyPair
that represents your app, the request token that represents
the session, and the "verifier" that represents the user's credentials and their acceptance of
your app's access.
The verifier
parameter comes from the Step 2 process you used. For PIN-Based Authorization,
the verifier is the PIN returned to the user after they sign in. For "Sign In With Twitter" and
3-Legged Authorization, the verifier is the string passed by twitter to your app through the
oauth_verifier
query string parameter. For more information, see the documentation for the
Authorize URL function.
Note that this function consumes con_token
, because it is inserted into the Token
that is
returned. If you would like to use the consumer token to authenticate multiple accounts in the
same session, clone the KeyPair
when passing it into this function.
The AuthFuture
returned by this function, on success, yields a tuple of three items: The
final access token, the ID of the authenticated user, and the screen name of the authenticated
user.