Crates.io | oidc_verify |
lib.rs | oidc_verify |
version | 0.2.0 |
source | src |
created_at | 2024-08-24 08:43:38.240647 |
updated_at | 2024-08-25 08:05:57.046527 |
description | A simple-usage OIDC-RS256 token verifier. It works without `authorization_endpoint` field, such as Firebase Auth. |
homepage | |
repository | https://github.com/gw31415/oidc_verify |
max_upload_size | |
id | 1350075 |
size | 22,879 |
This is a simple library to verify the JWT token of RS256 received from the OIDC provider.
This works without It works without authorization_endpoint
field, such as Firebase Auth.
This library depends on tokio
as an async runtime, so your project should select tokio
as an async runtime too.
use oidc_verify::prelude::*;
use serde_json::Value;
#[tokio::main]
async fn main() {
let verifier = Verifier::new("https://securetoken.google.com/hogehoge-fugafuga/");
let token = "Bearer 3x4mple.t0k3n".strip_prefix("Bearer ").unwrap();
match verifier.verify::<Value>(token).await {
Ok(claims) => {
println!("Claims: {}", serde_json::to_string_pretty(&claims).unwrap());
},
Err(err) => {
println!("Error: {:?}", err);
},
}
}
Apache 2.0