/// Make a request for an access token. The token is stored in OAuth and
/// will be used to make for making requests for refresh tokens. The below
/// example shows how access tokens are stored and retrieved for OAuth:
/// # Example
/// ```rust,ignore
/// # use graph_oauth::oauth::{OAuth, AccessToken};
/// let mut oauth: OAuth = OAuth::new();
///
/// // As an example create a random access token.
/// let mut access_token = AccessToken::default();
/// access_token.access_token("12345");
/// // Store the token in OAuth if the access token has a refresh token.
/// // The refresh token can be later used to request more access tokens.
/// oauth.access_token(access_token);
/// // You can get the actual bearer token if needed:
/// println!("{:#?}", oauth.get_access_token().unwrap().get_access_token());
/// ```
///
/// Request an access token.
/// # Example
/// ```rust,ignore
/// use graph_oauth::oauth::{Grant, OAuth};
/// let mut oauth: OAuth = OAuth::new();
///
/// // This assumes the user has been authenticated and
/// // the access_code from the request has been given:
/// oauth.access_code("access_code");
///
/// // To get an access token a access_token_url is needed and the grant_type
/// // should be set to token.
/// // There are other parameters that may need to be included depending on the
/// // authorization flow chosen.
/// // The url below is for the v1.0 drive API. You can also use the Graph URLs as well.
/// oauth.access_token_url("https://login.live.com/oauth20_token.srf")
///     .response_type("token")
///     .grant_type("authorization_code");
///
/// // Make a request for an access token.
/// let mut request = oauth.build().authorization_code_grant();
/// let access_token = request.access_token().send().unwrap();
/// println!("{:#?}", access_token);
/// ```
Make a request for an access token. The token is stored in OAuth and
will be used to make for making requests for refresh tokens. The below
example shows how access tokens are stored and retrieved for OAuth.
Make a request for an access token . The token is stored in OAuth and will be used to make for making requests for refresh tokens . The below example shows how access tokens are stored and retrieved for OAuth .
pub fn access_token(&mut self) -> AsyncAccessTokenRequest {
        self.oauth
            .pre_request_check(self.grant, GrantRequest::AccessToken);
        AsyncAccessTokenRequest {
            uri: self
                .oauth
                .get_or_else(OAuthCredential::AccessTokenURL)
                .unwrap(),
            params: self
                .oauth
                .params(self.grant.available_credentials(GrantRequest::AccessToken))
                .unwrap(),
        }
    }
pub fn access_token ( & mut self ) -> AsyncAccessTokenRequest { self . oauth . pre_request_check ( self . grant , GrantRequest :: AccessToken ) ; AsyncAccessTokenRequest { uri : self . oauth . get_or_else ( OAuthCredential :: AccessTokenURL ) . unwrap ( ) , params : self . oauth . params ( self . grant . available_credentials ( GrantRequest :: AccessToken ) ) . unwrap ( ) , } }
Make a request for an access token.
Make a request for an access token .
&mut self
example
None
use graph_oauth::oauth::{oauth, accesstoken};
let mut oauth: OAuth = OAuth::new().

As an example create a random access token.
let mut access_token = AccessToken::default();
access_token.access_token("12345");
Store the token in OAuth if the access token has a refresh token.
The refresh token can be later used to request more access tokens.
oauth.access_token(access_token);
You can get the actual bearer token if needed:
println!("{:#?}", oauth.get_access_token().unwrap().get_access_token());
```

Request an access token.
let mut oauth : OAuth = OAuth :: new () . As an example create a random access token . let mut access_token = AccessToken :: default () ; access_token . access_token ( " 12345 " ) ; Store the token in OAuth if the access token has a refresh token . The refresh token can be later used to request more access tokens . oauth . access_token ( access_token ) ; You can get the actual bearer token if needed : println! ( " { : #? } " oauth . get_access_token () . unwrap () . get_access_token () ) ; ` ` ` Request an access token .
example
```rust,ignore
use graph_oauth::oauth::{Grant, OAuth};
let mut oauth: OAuth = OAuth::new().

This assumes the user has been authenticated and
the access_code from the request has been given:
oauth.access_code("access_code").

To get an access token a access_token_url is needed and the grant_type
should be set to token.
There are other parameters that may need to be included depending on the
authorization flow chosen.
The url below is for the v1.0 drive API. You can also use the Graph URLs as well.

Make a request for an access token.
let mut request = oauth.build().authorization_code_grant();
let access_token = request.access_token().send().unwrap();
println!("{:#?}", access_token);
```
` ` ` rust ignore use graph_oauth :: oauth :: { Grant OAuth } ; let mut oauth : OAuth = OAuth :: new () . This assumes the user has been authenticated and the access_code from the request has been given : oauth . access_code ( " access_code " ) . To get an access token a access_token_url is needed and the grant_type should be set to token . There are other parameters that may need to be included depending on the authorization flow chosen . The url below is for the v1 . 0 drive API . You can also use the Graph URLs as well . Make a request for an access token . let mut request = oauth . build () . authorization_code_grant () ; let access_token = request . access_token () . send () . unwrap () ; println! ( " { : #? } " access_token ) ; ` ` `