pub async fn access(user_agent: &str, refresh_token: &str) -> Result<String, Error> {
    let refresh_token = valid_refresh_token_from_str(user_agent, refresh_token).await?;

    let user = match STORAGE.get_user(&refresh_token.email).await {
        Some(v) => v,
        None => {
            println!("valid token for non-existent email {:?}", refresh_token);
            return Err(remove_bad_refresh_token(&refresh_token).await);
        }
    };

    create_jwt(&user).map_err(|e| {
        println!("jwt create err: {}", e);
        Error::InternalError
    })
}
/// On success, returns an access token that can be used to authorize with other APIs.
///
/// The access request includes a refresh token that will only work for the user agent that
/// originally created the token. If the provided token is used from a different user agent, then
/// the token will be invalidated.
On success, returns an access token that can be used to authorize with other APIs.
The access request includes a refresh token that will only work for the user agent that
originally created the token. If the provided token is used from a different user agent, then
the token will be invalidated.
On success returns an access token that can be used to authorize with other APIs . The access request includes a refresh token that will only work for the user agent that originally created the token . If the provided token is used from a different user agent then the token will be invalidated .
pub async fn access(user_agent: &str, refresh_token: &str) -> Result<String, Error> {
    let refresh_token = valid_refresh_token_from_str(user_agent, refresh_token).await?;
    let user = match STORAGE.get_user(&refresh_token.email).await {
        Some(v) => v,
        None => {
            println!("valid token for non-existent email {:?}", refresh_token);
            return Err(remove_bad_refresh_token(&refresh_token).await);
        }
    };
    create_jwt(&user).map_err(|e| {
        println!("jwt create err: {}", e);
        Error::InternalError
    })
}
pub async fn access ( user_agent : & str , refresh_token : & str ) -> Result < String , Error > { let refresh_token = valid_refresh_token_from_str ( user_agent , refresh_token ) . await ? ; let user = match STORAGE . get_user ( & refresh_token . email ) . await { Some ( v ) => v , None => { println ! ( " " refresh_token ) ; return Err ( remove_bad_refresh_token ( & refresh_token ) . await ) ; } } ; create_jwt ( & user ) . map_err ( | e | { println ! ( " " e ) ; Error :: InternalError } ) }
On success, returns an access token that can be used to authorize with other APIs.
On success returns an access token that can be used to authorize with other APIs .
user_agent
&str
refresh_token
&str
user_agent
&str
refresh_token
&str