Struct rawr::auth::PasswordAuthenticator [] [src]

pub struct PasswordAuthenticator {
    // some fields omitted
}

Authenticates using a username and password with OAuth. See the module-level documentation for usage.

Methods

impl PasswordAuthenticator
[src]

fn new(client_id: &str, client_secret: &str, username: &str, password: &str) -> Arc<Mutex<Box<Authenticator + Send>>>

Creates a new PasswordAuthenticator. If you do not have a client ID and secret (or do not know what these are), you need to fetch one using the instructions in the module documentation.

Trait Implementations

impl Authenticator for PasswordAuthenticator
[src]

fn login(&mut self, client: &Client, user_agent: &str) -> Result<(), APIError>

Logs in and fetches relevant tokens.

fn logout(&mut self, client: &Client, user_agent: &str) -> Result<(), APIError>

Logs out and invalidates tokens if applicable.

fn scopes(&self) -> Vec<String>

A list of OAuth scopes that this Authenticator can access. Currently, the result of this is not used, but the correct scopes should be returned. If all scopes can be accessed, this is signified by a vec!["*"]. If it is read-only, the result is vec!["read"]. Read more

fn headers(&self) -> Headers

Returns the headers needed to authenticate. Must be done after login().

fn oauth(&self) -> bool

true if this authentication method requires the OAuth API.

fn refresh_token(&mut self, client: &Client, user_agent: &str) -> Result<(), APIError>

Called if a token expiration error occurs.