Crate graph_oauth

source ·
Expand description

OAuth client for the graph-rs project.

See the project on GitHub.


An authorization and access token client for Microsoft Graph and the OAuth 2.0 authorization framework. This project is specifically meant to be used for the Microsoft Graph Api.


Using this API for other resource owners besides Microsoft may work but functionality will more then likely be limited.


use graph_oauth::oauth::OAuth;
let mut oauth = OAuth::new();

Get the access code for the authorization code grant by sending the user to log in using their browser.

let mut request =;
let _ = request.browser_authorization().open();

The access code will be appended to the url on redirect. Pass this code to the OAuth instance:

oauth.access_code("<ACCESS CODE>");

Perform an authorization code grant request for an access token:

let mut request =;

let access_token = request.access_token().send().unwrap();
println!("{:#?}", access_token);