Skip to main content

profile

Function profile 

Source
pub fn profile(
    provider: &'static Provider,
    access_token: &str,
) -> impl Future<Output = Result<Profile>> + Send + use<>
Expand description

Reads the signed-in user’s Profile with an access token (one subrequest; two for GitHub).

The email is kept only when the provider marks it verified (GitHub: the primary verified address of /user/emails; Google: email_verified).

§Errors

Error::Internal when the provider cannot be reached or answers something unexpected (a revoked token included).

§Examples

use ocre::{Result, oauth::{GOOGLE, profile}};

async fn email(token: &str) -> Result<Option<String>> {
    Ok(profile(&GOOGLE, token).await?.email)
}