pub async fn verify(&self, id_token: &str) -> Result<IdInfo, Error> {
        let unverified_header = jsonwebtoken::decode_header(&id_token)?;

        let mut certs = self.certs.lock().await;
        certs.refresh_if_needed(self).await?;

        match unverified_header.kid {
            Some(kid) => {
                let cert = certs.keys.get(&kid).ok_or(Error::InvalidKey)?;
                self.verify_single(id_token, cert)
            }
            None => certs
                .keys
                .values()
                .flat_map(|cert| self.verify_single(id_token, cert))
                .next()
                .ok_or(Error::InvalidToken),
        }
    }
/// Verifies that the token is signed by Google's OAuth cerificate,
/// and check that it has a valid issuer, audience, and hosted domain.
/// Returns an error if the client has no configured audiences.
Verifies that the token is signed by Google's OAuth cerificate,
and check that it has a valid issuer, audience, and hosted domain.
Returns an error if the client has no configured audiences.
Verifies that the token is signed by Google ' s OAuth cerificate and check that it has a valid issuer audience and hosted domain . Returns an error if the client has no configured audiences .
pub async fn verify(&self, id_token: &str) -> Result<IdInfo, Error> {
        let unverified_header = jsonwebtoken::decode_header(&id_token)?;
        let mut certs = self.certs.lock().await;
        certs.refresh_if_needed(self).await?;
        match unverified_header.kid {
            Some(kid) => {
                let cert = certs.keys.get(&kid).ok_or(Error::InvalidKey)?;
                self.verify_single(id_token, cert)
            }
            None => certs
                .keys
                .values()
                .flat_map(|cert| self.verify_single(id_token, cert))
                .next()
                .ok_or(Error::InvalidToken),
        }
    }
pub async fn verify ( & self , id_token : & str ) -> Result < IdInfo , Error > { let unverified_header = jsonwebtoken :: decode_header ( & id_token ) ? ; let mut certs = self . certs . lock ( ) . await ; certs . refresh_if_needed ( self ) . await ? ; match unverified_header . kid { Some ( kid ) => { let cert = certs . keys . get ( & kid ) . ok_or ( Error :: InvalidKey ) ? ; self . verify_single ( id_token , cert ) } None => certs . keys . values ( ) . flat_map ( | cert | self . verify_single ( id_token , cert ) ) . next ( ) . ok_or ( Error :: InvalidToken ) , } }
Verifies that the token is signed by Google's OAuth cerificate,
and check that it has a valid issuer, audience, and hosted domain.
Verifies that the token is signed by Google ' s OAuth cerificate and check that it has a valid issuer audience and hosted domain .
&self
id_token
&str
&self
id_token
&str