Skip to content

Validating Google aud field throws an error #110

@rokit

Description

@rokit

I have the following code that creates a validation struct and decodes a token:

        let aud = 
            "my-googleclientid1234.apps.googleusercontent.com".to_string();
        let mut aud_hashset = HashSet::new();
        aud_hashset.insert(aud);
        let validation = Validation {
            algorithms: vec![Algorithm::RS256],
            aud: Some(aud_hashset),
            ..Validation::default()
        };

        let token_data_rsa = jwt::decode_rsa_components::<GooglePayload>(&token, &n, &e, &validation);

But it throws an error:
Err(Error(Json(Error("invalid type: string \"my-googleclientid1234.apps.googleusercontent.com\", expected a sequence", line: 0, column: 0))))

If I don't try to validate the aud field, then the token decodes as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions