You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Decode a JWT without any signature verification and return its claims.
291
+
/// This means that the token is not verified so use with caution.
292
+
/// This is useful when you want to extract the claims without verifying the signature.
293
+
///
294
+
/// # Arguments
295
+
///
296
+
/// * `token` - A string slice that holds the JWT token
297
+
/// * `validation` - A [Validation](struct.Validation.html) object that holds the validation options
298
+
///
299
+
/// # Example
300
+
///
301
+
/// ```rust
302
+
/// use jsonwebtoken::{insecure_decode_without_signature_validation, Validation, Algorithm};
303
+
/// use serde::{Deserialize, Serialize};
304
+
///
305
+
/// #[derive(Debug, Serialize, Deserialize)]
306
+
/// struct Claims {
307
+
/// sub: u32,
308
+
/// name: String,
309
+
/// iat: u64,
310
+
/// exp: u64
311
+
/// }
312
+
///
313
+
/// // Example token from jwt.io
314
+
/// let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEyMzQ1Njc4OTAsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTUxNjIzOTAyMiwiZXhwIjoyNTE2MjM5MDYwfQ.Yf3kCk-BdkW3DZNao3lwMoU41ujnt86OgewBA-Q2uBw".to_string();
315
+
/// let validation = Validation::new(Algorithm::HS256);
316
+
/// let claims = insecure_decode_without_signature_validation::<Claims>(&token, &validation).unwrap();
0 commit comments