Struct github_device_oauth::DeviceFlow
source · pub struct DeviceFlow { /* private fields */ }
Implementations§
source§impl DeviceFlow
impl DeviceFlow
sourcepub fn new(client_id: String, host: String, scopes: String) -> Self
pub fn new(client_id: String, host: String, scopes: String) -> Self
Examples found in repository?
examples/simple.rs (line 10)
4 5 6 7 8 9 10 11 12 13 14 15 16
async fn main() {
let client_id = std::env::var("GITHUB_CLIENT_ID").unwrap();
let retrieve_refresh_token =
|| std::env::var("GITHUB_REFRESH_TOKEN").map_err(|_| DeviceFlowError::RefreshTokenNotFound);
let host = "github.com".to_owned();
let scopes = "read:user".to_owned();
let flow = DeviceFlow::new(client_id, host, scopes);
let cred = flow
.refresh_or_authorize(retrieve_refresh_token)
.await
.unwrap();
dbg!(cred);
}
Examples found in repository?
examples/simple.rs (line 12)
4 5 6 7 8 9 10 11 12 13 14 15 16
async fn main() {
let client_id = std::env::var("GITHUB_CLIENT_ID").unwrap();
let retrieve_refresh_token =
|| std::env::var("GITHUB_REFRESH_TOKEN").map_err(|_| DeviceFlowError::RefreshTokenNotFound);
let host = "github.com".to_owned();
let scopes = "read:user".to_owned();
let flow = DeviceFlow::new(client_id, host, scopes);
let cred = flow
.refresh_or_authorize(retrieve_refresh_token)
.await
.unwrap();
dbg!(cred);
}
Trait Implementations§
source§impl Clone for DeviceFlow
impl Clone for DeviceFlow
source§fn clone(&self) -> DeviceFlow
fn clone(&self) -> DeviceFlow
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DeviceFlow
impl RefUnwindSafe for DeviceFlow
impl Send for DeviceFlow
impl Sync for DeviceFlow
impl Unpin for DeviceFlow
impl UnwindSafe for DeviceFlow
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more