pub async fn is_valid_sso<T: Client + TokenClient + CacheClient>(
        &self,
        client: &T,
        sso_team: &str,
        // Making this optional since there are cases where we don't want to do anything after
        // validation.
        // A callback that gets called if the token is valid. This will be
        // passed in a user's email if the token is valid.
        valid_message_fn: Option<impl FnOnce(&str)>,
    ) -> Result<bool, Error> {
        let is_active = self.is_active(client).await?;
        let (result_user, result_team) = tokio::join!(
            client.get_user(self.into_inner()),
            client.get_team(self.into_inner(), sso_team)
        );

        match (result_user, result_team) {
            (Ok(response_user), Ok(response_team)) => {
                let team =
                    response_team.ok_or_else(|| Error::SSOTeamNotFound(sso_team.to_owned()))?;
                let info = TeamInfo {
                    id: &team.id,
                    slug: &team.slug,
                };
                if info.slug != sso_team {
                    return Err(Error::SSOTeamNotFound(sso_team.to_owned()));
                }

                let has_cache_access = self
                    .has_cache_access(client, Some(info.id), Some(info.slug))
                    .await?;
                if !is_active || !has_cache_access {
                    return Ok(false);
                }

                if let Some(message_callback) = valid_message_fn {
                    message_callback(&response_user.user.email);
                };

                Ok(true)
            }
            (Err(e), _) | (_, Err(e)) => match e {
                turborepo_api_client::Error::ReqwestError(e) => {
                    self.handle_sso_token_error(client, e).await
                }
                e => Err(Error::APIError(e)),
            },
        }
    }
This is the same as `is_valid`, but also checks if the token is valid
for SSO.

## Arguments
* `client` - The client to use for API calls.
* `sso_team` - The team to validate the token against.
* `valid_message_fn` - An optional callback that gets called if the
token is valid. It will be passed the user's email.
crates/turborepo-auth/src/lib.rs