[{"data":1,"prerenderedAt":1197},["ShallowReactive",2],{"$fZ8_pLgbbr9JSRhBUkFnkf4D70W00P7sDUT_G6A5mPU4":3},{"slug":4,"title":5,"description":6,"source":7,"document":8,"toc":1179,"editUrl":1191,"prev":1192,"next":1195},"techniques\u002Fauthentication","Authentication (JWT)","Issue and verify HS256 JWTs with JwtService, protect routes with AuthGuard, and read the current user.","---\ntitle: Authentication (JWT)\ndescription: Issue and verify HS256 JWTs with JwtService, protect routes with AuthGuard, and read the current user.\n---\n\n# Authentication (JWT)\n\n`ferrite-auth-jwt` provides HS256 JWT sign\u002Fverify, a route guard, and a `CurrentUser` extractor — zero external services required.\n\n## Enable it\n\n```cargo\nfr add auth-jwt\n```\n\n```rust\n#[module(imports = [AuthModule])]\npub struct AppModule;\n```\n\n## Configuration\n\n| Env | Default | Purpose |\n| --- | --- | --- |\n| `JWT_SECRET` | `ferrite-dev-secret-change-me` | HMAC key |\n| `JWT_EXPIRES_IN` | `86400` (seconds) | Token TTL |\n\nAlways set `JWT_SECRET` in production — `fr doctor` and the crate help you catch misses.\n\n## `JwtService`\n\n```rust\nuse ferrite_auth_jwt::JwtService;\n\n#[injectable]\npub struct AuthService {\n    jwt: JwtService,\n}\n\nimpl AuthService {\n    #[inject]\n    pub fn new(jwt: JwtService) -> Self {\n        Self { jwt }\n    }\n\n    pub async fn login(&self, user_id: i64, email: &str) -> Result\u003CString, crate::Error> {\n        Ok(self.jwt.sign(user_id, email)?)\n    }\n}\n```\n\n| Method | Returns |\n| --- | --- |\n| `sign(sub: i64, email: &str) -> Result\u003CString, JwtError>` | `\"eyJ...` |\n| `verify(token) -> Result\u003CJwtClaims, JwtError>` | Decoded claims |\n| `secret() -> String` | Effective secret |\n| `default_ttl_secs() -> u64` | Effective TTL |\n| `header() -> &'static Header` | Bearer header value |\n\n### Claims\n\n```rust\npub struct JwtClaims {\n    pub sub: i64,          \u002F\u002F subject (user id)\n    pub email: String,\n    pub exp: usize,        \u002F\u002F expiry (unix seconds)\n    pub iss: Option\u003CString>, \u002F\u002F issuer (optional)\n}\n```\n\n`JwtError` distinguishes `MissingSecret`, `InvalidToken(String)`, `MissingBearer`, and `MalformedHeader` — the message includes `missing JWT_SECRET env variable` when relevant.\n\n## Protecting routes with `AuthGuard`\n\n```rust\nuse ferrite_auth_jwt::AuthGuard;\n\n#[impl_controller]\n#[use_guards(AuthGuard)]\nimpl UsersController {\n    #[get(\"\u002Fme\")]\n    pub async fn me(&self, CurrentUser(claims): CurrentUser) -> Result\u003CJson\u003CUser>, HttpError> {\n        \u002F\u002F claims: JwtClaims — already verified\n        Ok(Json(self.service.find(claims.sub).await?))\n    }\n}\n```\n\n`AuthGuard` verifies the `Authorization: Bearer \u003Ctoken>` header in `can_activate`. It also exposes `extract_bearer(ctx: &RequestCtx) -> Result\u003CString, JwtError>` if you need the raw token.\n\n## Reading the current user\n\n`CurrentUser(pub JwtClaims)` is an Axum `FromRequestParts` extractor — it takes the bearer token, verifies it, and rejects with a `401` if absent or invalid:\n\n```rust\npub async fn me(&self, CurrentUser(claims): CurrentUser) -> String {\n    format!(\"Hello {}\", claims.email)\n}\n```\n\n## A login endpoint\n\n```rust\n#[controller(\"\u002Fauth\")]\npub struct AuthController { auth: AuthService }\n\n#[impl_controller]\nimpl AuthController {\n    #[inject]\n    pub fn new(auth: AuthService) -> Self { Self { auth } }\n\n    #[post(\"\u002Flogin\")]\n    pub async fn login(&self, Json(dto): Json\u003CLoginDto>) -> Result\u003CJson\u003CTokenResponse>, HttpError> {\n        let user = self.auth.validate(&dto).await?;\n        let token = self.auth.login(user.id, &user.email)\n            .map_err(|_| HttpError::unauthorized(\"cannot issue token\"))?;\n        Ok(Json(TokenResponse { token }))\n    }\n}\n```\n\n## Notes\n\n- There is **no** `JwtAuthGuard` type — the guard is `AuthGuard`.\n- Guard metadata flows into the OpenAPI spec automatically: guarded routes get a `401` response and the `bearer` security scheme (see [OpenAPI & Swagger](\u002Fdocs\u002Ffundamentals\u002Fopenapi-swagger)).\n\n## Next steps\n\n- [OAuth2 & OIDC](\u002Fdocs\u002Ftechniques\u002Foauth2-oidc) — social login that mints the same JWT flavor.\n- [Guards](\u002Fdocs\u002Foverview\u002Fguards).",{"frontmatter":9,"meta":10,"nodes":44},{"title":5,"description":6},{"toc":11},{"title":12,"searchDepth":13,"depth":14,"links":15},"On This Page",2,3,[16,19,22,29,32,35,38,41],{"id":17,"depth":13,"text":18},"enable-it","Enable it",{"id":20,"depth":13,"text":21},"configuration","Configuration",{"id":23,"depth":13,"text":24,"children":25},"jwtservice","JwtService",[26],{"id":27,"depth":14,"text":28},"jwtservice-claims","Claims",{"id":30,"depth":13,"text":31},"protecting-routes-with-authguard","Protecting routes with AuthGuard",{"id":33,"depth":13,"text":34},"reading-the-current-user","Reading the current user",{"id":36,"depth":13,"text":37},"a-login-endpoint","A login endpoint",{"id":39,"depth":13,"text":40},"notes","Notes",{"id":42,"depth":13,"text":43},"next-steps","Next steps",[45,49,61,64,73,118,120,174,184,188,408,474,477,568,592,598,752,769,771,785,845,847,1126,1128,1162,1164],[46,47,5],"h1",{"id":48},"authentication-jwt",[50,51,52,56,57,60],"p",{},[53,54,55],"code",{},"ferrite-auth-jwt"," provides HS256 JWT sign\u002Fverify, a route guard, and a ",[53,58,59],{},"CurrentUser"," extractor — zero external services required.",[62,63,18],"h2",{"id":17},[65,66,69],"pre",{"language":67,"class":68},"cargo","shiki dark:github-dark",[53,70,72],{"class":71},"language-cargo","fr add auth-jwt",[65,74,77],{"language":75,"class":76},"rust","shiki shiki-themes github-light github-dark dark:github-dark",[53,78,80,103,104],{"class":79},"language-rust",[81,82,85,89,93,96,100],"span",{"class":83,"style":84},"line","display: inline",[81,86,88],{"style":87},"color:#24292E;--shiki-dark:#E1E4E8","#[module(imports ",[81,90,92],{"style":91},"color:#D73A49;--shiki-dark:#F97583","=",[81,94,95],{"style":87}," [",[81,97,99],{"style":98},"color:#6F42C1;--shiki-dark:#B392F0","AuthModule",[81,101,102],{"style":87},"])]","\n",[81,105,106,109,112,115],{"class":83,"style":84},[81,107,108],{"style":91},"pub",[81,110,111],{"style":91}," struct",[81,113,114],{"style":98}," AppModule",[81,116,117],{"style":87},";",[62,119,21],{"id":20},[121,122,123,139],"table",{},[124,125,126],"thead",{},[127,128,129,133,136],"tr",{},[130,131,132],"th",{},"Env",[130,134,135],{},"Default",[130,137,138],{},"Purpose",[140,141,142,158],"tbody",{},[127,143,144,150,155],{},[145,146,147],"td",{},[53,148,149],{},"JWT_SECRET",[145,151,152],{},[53,153,154],{},"ferrite-dev-secret-change-me",[145,156,157],{},"HMAC key",[127,159,160,165,171],{},[145,161,162],{},[53,163,164],{},"JWT_EXPIRES_IN",[145,166,167,170],{},[53,168,169],{},"86400"," (seconds)",[145,172,173],{},"Token TTL",[50,175,176,177,179,180,183],{},"Always set ",[53,178,149],{}," in production — ",[53,181,182],{},"fr doctor"," and the crate help you catch misses.",[62,185,186],{"id":23},[53,187,24],{},[65,189,190],{"language":75,"class":76},[53,191,192,103,207,103,209,103,214,103,226,103,240,103,245,103,247,103,256,103,261,103,291,103,299,103,304,103,306,103,371,103,400,103,404],{"class":79},[81,193,194,197,200,203,205],{"class":83,"style":84},[81,195,196],{"style":91},"use",[81,198,199],{"style":98}," ferrite_auth_jwt",[81,201,202],{"style":91},"::",[81,204,24],{"style":98},[81,206,117],{"style":87},[81,208],{"class":83,"style":84},[81,210,211],{"class":83,"style":84},[81,212,213],{"style":87},"#[injectable]",[81,215,216,218,220,223],{"class":83,"style":84},[81,217,108],{"style":91},[81,219,111],{"style":91},[81,221,222],{"style":98}," AuthService",[81,224,225],{"style":87}," {",[81,227,228,231,234,237],{"class":83,"style":84},[81,229,230],{"style":87},"    jwt",[81,232,233],{"style":91},":",[81,235,236],{"style":98}," JwtService",[81,238,239],{"style":87},",",[81,241,242],{"class":83,"style":84},[81,243,244],{"style":87},"}",[81,246],{"class":83,"style":84},[81,248,249,252,254],{"class":83,"style":84},[81,250,251],{"style":91},"impl",[81,253,222],{"style":98},[81,255,225],{"style":87},[81,257,258],{"class":83,"style":84},[81,259,260],{"style":87},"    #[inject]",[81,262,263,266,269,272,275,277,279,282,285,289],{"class":83,"style":84},[81,264,265],{"style":91},"    pub",[81,267,268],{"style":91}," fn",[81,270,271],{"style":98}," new",[81,273,274],{"style":87},"(jwt",[81,276,233],{"style":91},[81,278,236],{"style":98},[81,280,281],{"style":87},") ",[81,283,284],{"style":91},"->",[81,286,288],{"style":287},"color:#005CC5;--shiki-dark:#79B8FF"," Self",[81,290,225],{"style":87},[81,292,293,296],{"class":83,"style":84},[81,294,295],{"style":287},"        Self",[81,297,298],{"style":87}," { jwt }",[81,300,301],{"class":83,"style":84},[81,302,303],{"style":87},"    }",[81,305],{"class":83,"style":84},[81,307,308,310,313,315,318,321,324,327,330,332,335,338,340,343,346,348,350,353,356,359,362,365,368],{"class":83,"style":84},[81,309,265],{"style":91},[81,311,312],{"style":91}," async",[81,314,268],{"style":91},[81,316,317],{"style":98}," login",[81,319,320],{"style":87},"(",[81,322,323],{"style":91},"&",[81,325,326],{"style":287},"self",[81,328,329],{"style":87},", user_id",[81,331,233],{"style":91},[81,333,334],{"style":98}," i64",[81,336,337],{"style":87},", email",[81,339,233],{"style":91},[81,341,342],{"style":91}," &",[81,344,345],{"style":98},"str",[81,347,281],{"style":87},[81,349,284],{"style":91},[81,351,352],{"style":98}," Result",[81,354,355],{"style":87},"\u003C",[81,357,358],{"style":98},"String",[81,360,361],{"style":87},", ",[81,363,364],{"style":91},"crate::",[81,366,367],{"style":98},"Error",[81,369,370],{"style":87},"> {",[81,372,373,376,378,380,383,386,388,391,394,397],{"class":83,"style":84},[81,374,375],{"style":98},"        Ok",[81,377,320],{"style":87},[81,379,326],{"style":287},[81,381,382],{"style":91},".",[81,384,385],{"style":87},"jwt",[81,387,382],{"style":91},[81,389,390],{"style":98},"sign",[81,392,393],{"style":87},"(user_id, email)",[81,395,396],{"style":91},"?",[81,398,399],{"style":87},")",[81,401,402],{"class":83,"style":84},[81,403,303],{"style":87},[81,405,406],{"class":83,"style":84},[81,407,244],{"style":87},[121,409,410,420],{},[124,411,412],{},[127,413,414,417],{},[130,415,416],{},"Method",[130,418,419],{},"Returns",[140,421,422,434,444,454,464],{},[127,423,424,429],{},[145,425,426],{},[53,427,428],{},"sign(sub: i64, email: &str) -> Result\u003CString, JwtError>",[145,430,431],{},[53,432,433],{},"\"eyJ...",[127,435,436,441],{},[145,437,438],{},[53,439,440],{},"verify(token) -> Result\u003CJwtClaims, JwtError>",[145,442,443],{},"Decoded claims",[127,445,446,451],{},[145,447,448],{},[53,449,450],{},"secret() -> String",[145,452,453],{},"Effective secret",[127,455,456,461],{},[145,457,458],{},[53,459,460],{},"default_ttl_secs() -> u64",[145,462,463],{},"Effective TTL",[127,465,466,471],{},[145,467,468],{},[53,469,470],{},"header() -> &'static Header",[145,472,473],{},"Bearer header value",[475,476,28],"h3",{"id":27},[65,478,479],{"language":75,"class":76},[53,480,481,103,492,103,510,103,524,103,542,103,564],{"class":79},[81,482,483,485,487,490],{"class":83,"style":84},[81,484,108],{"style":91},[81,486,111],{"style":91},[81,488,489],{"style":98}," JwtClaims",[81,491,225],{"style":87},[81,493,494,496,499,501,503,506],{"class":83,"style":84},[81,495,265],{"style":91},[81,497,498],{"style":87}," sub",[81,500,233],{"style":91},[81,502,334],{"style":98},[81,504,505],{"style":87},",          ",[81,507,509],{"style":508},"color:#6A737D;--shiki-dark:#6A737D","\u002F\u002F subject (user id)",[81,511,512,514,517,519,522],{"class":83,"style":84},[81,513,265],{"style":91},[81,515,516],{"style":87}," email",[81,518,233],{"style":91},[81,520,521],{"style":98}," String",[81,523,239],{"style":87},[81,525,526,528,531,533,536,539],{"class":83,"style":84},[81,527,265],{"style":91},[81,529,530],{"style":87}," exp",[81,532,233],{"style":91},[81,534,535],{"style":98}," usize",[81,537,538],{"style":87},",        ",[81,540,541],{"style":508},"\u002F\u002F expiry (unix seconds)",[81,543,544,546,549,551,554,556,558,561],{"class":83,"style":84},[81,545,265],{"style":91},[81,547,548],{"style":87}," iss",[81,550,233],{"style":91},[81,552,553],{"style":98}," Option",[81,555,355],{"style":87},[81,557,358],{"style":98},[81,559,560],{"style":87},">, ",[81,562,563],{"style":508},"\u002F\u002F issuer (optional)",[81,565,566],{"class":83,"style":84},[81,567,244],{"style":87},[50,569,570,573,574,361,577,361,580,583,584,587,588,591],{},[53,571,572],{},"JwtError"," distinguishes ",[53,575,576],{},"MissingSecret",[53,578,579],{},"InvalidToken(String)",[53,581,582],{},"MissingBearer",", and ",[53,585,586],{},"MalformedHeader"," — the message includes ",[53,589,590],{},"missing JWT_SECRET env variable"," when relevant.",[62,593,594,595],{"id":30},"Protecting routes with ",[53,596,597],{},"AuthGuard",[65,599,600],{"language":75,"class":76},[53,601,602,103,614,103,616,103,621,103,631,103,640,103,651,103,703,103,708,103,744,103,748],{"class":79},[81,603,604,606,608,610,612],{"class":83,"style":84},[81,605,196],{"style":91},[81,607,199],{"style":98},[81,609,202],{"style":91},[81,611,597],{"style":98},[81,613,117],{"style":87},[81,615],{"class":83,"style":84},[81,617,618],{"class":83,"style":84},[81,619,620],{"style":87},"#[impl_controller]",[81,622,623,626,628],{"class":83,"style":84},[81,624,625],{"style":87},"#[use_guards(",[81,627,597],{"style":98},[81,629,630],{"style":87},")]",[81,632,633,635,638],{"class":83,"style":84},[81,634,251],{"style":91},[81,636,637],{"style":98}," UsersController",[81,639,225],{"style":87},[81,641,642,645,649],{"class":83,"style":84},[81,643,644],{"style":87},"    #[get(",[81,646,648],{"style":647},"color:#032F62;--shiki-dark:#9ECBFF","\"\u002Fme\"",[81,650,630],{"style":87},[81,652,653,655,657,659,662,664,666,668,670,672,675,677,680,682,684,686,688,691,693,696,698,701],{"class":83,"style":84},[81,654,265],{"style":91},[81,656,312],{"style":91},[81,658,268],{"style":91},[81,660,661],{"style":98}," me",[81,663,320],{"style":87},[81,665,323],{"style":91},[81,667,326],{"style":287},[81,669,361],{"style":87},[81,671,59],{"style":98},[81,673,674],{"style":87},"(claims)",[81,676,233],{"style":91},[81,678,679],{"style":98}," CurrentUser",[81,681,281],{"style":87},[81,683,284],{"style":91},[81,685,352],{"style":98},[81,687,355],{"style":87},[81,689,690],{"style":98},"Json",[81,692,355],{"style":87},[81,694,695],{"style":98},"User",[81,697,560],{"style":87},[81,699,700],{"style":98},"HttpError",[81,702,370],{"style":87},[81,704,705],{"class":83,"style":84},[81,706,707],{"style":508},"        \u002F\u002F claims: JwtClaims — already verified",[81,709,710,712,714,716,718,720,722,725,727,730,733,735,738,741],{"class":83,"style":84},[81,711,375],{"style":98},[81,713,320],{"style":87},[81,715,690],{"style":98},[81,717,320],{"style":87},[81,719,326],{"style":287},[81,721,382],{"style":91},[81,723,724],{"style":87},"service",[81,726,382],{"style":91},[81,728,729],{"style":98},"find",[81,731,732],{"style":87},"(claims",[81,734,382],{"style":91},[81,736,737],{"style":87},"sub)",[81,739,740],{"style":91},".await?",[81,742,743],{"style":87},"))",[81,745,746],{"class":83,"style":84},[81,747,303],{"style":87},[81,749,750],{"class":83,"style":84},[81,751,244],{"style":87},[50,753,754,756,757,760,761,764,765,768],{},[53,755,597],{}," verifies the ",[53,758,759],{},"Authorization: Bearer \u003Ctoken>"," header in ",[53,762,763],{},"can_activate",". It also exposes ",[53,766,767],{},"extract_bearer(ctx: &RequestCtx) -> Result\u003CString, JwtError>"," if you need the raw token.",[62,770,34],{"id":33},[50,772,773,776,777,780,781,784],{},[53,774,775],{},"CurrentUser(pub JwtClaims)"," is an Axum ",[53,778,779],{},"FromRequestParts"," extractor — it takes the bearer token, verifies it, and rejects with a ",[53,782,783],{},"401"," if absent or invalid:",[65,786,787],{"language":75,"class":76},[53,788,789,103,823,103,841],{"class":79},[81,790,791,793,795,797,799,801,803,805,807,809,811,813,815,817,819,821],{"class":83,"style":84},[81,792,108],{"style":91},[81,794,312],{"style":91},[81,796,268],{"style":91},[81,798,661],{"style":98},[81,800,320],{"style":87},[81,802,323],{"style":91},[81,804,326],{"style":287},[81,806,361],{"style":87},[81,808,59],{"style":98},[81,810,674],{"style":87},[81,812,233],{"style":91},[81,814,679],{"style":98},[81,816,281],{"style":87},[81,818,284],{"style":91},[81,820,521],{"style":98},[81,822,225],{"style":87},[81,824,825,828,830,833,836,838],{"class":83,"style":84},[81,826,827],{"style":98},"    format!",[81,829,320],{"style":87},[81,831,832],{"style":647},"\"Hello {}\"",[81,834,835],{"style":87},", claims",[81,837,382],{"style":91},[81,839,840],{"style":87},"email)",[81,842,843],{"class":83,"style":84},[81,844,244],{"style":87},[62,846,37],{"id":36},[65,848,849],{"language":75,"class":76},[53,850,851,103,861,103,880,103,882,103,886,103,894,103,898,103,928,103,930,103,940,103,995,103,1029,103,1066,103,1103,103,1118,103,1122],{"class":79},[81,852,853,856,859],{"class":83,"style":84},[81,854,855],{"style":87},"#[controller(",[81,857,858],{"style":647},"\"\u002Fauth\"",[81,860,630],{"style":87},[81,862,863,865,867,870,873,875,877],{"class":83,"style":84},[81,864,108],{"style":91},[81,866,111],{"style":91},[81,868,869],{"style":98}," AuthController",[81,871,872],{"style":87}," { auth",[81,874,233],{"style":91},[81,876,222],{"style":98},[81,878,879],{"style":87}," }",[81,881],{"class":83,"style":84},[81,883,884],{"class":83,"style":84},[81,885,620],{"style":87},[81,887,888,890,892],{"class":83,"style":84},[81,889,251],{"style":91},[81,891,869],{"style":98},[81,893,225],{"style":87},[81,895,896],{"class":83,"style":84},[81,897,260],{"style":87},[81,899,900,902,904,906,909,911,913,915,917,919,922,925],{"class":83,"style":84},[81,901,265],{"style":91},[81,903,268],{"style":91},[81,905,271],{"style":98},[81,907,908],{"style":87},"(auth",[81,910,233],{"style":91},[81,912,222],{"style":98},[81,914,281],{"style":87},[81,916,284],{"style":91},[81,918,288],{"style":287},[81,920,921],{"style":87}," { ",[81,923,924],{"style":287},"Self",[81,926,927],{"style":87}," { auth } }",[81,929],{"class":83,"style":84},[81,931,932,935,938],{"class":83,"style":84},[81,933,934],{"style":87},"    #[post(",[81,936,937],{"style":647},"\"\u002Flogin\"",[81,939,630],{"style":87},[81,941,942,944,946,948,950,952,954,956,958,960,963,965,968,970,973,976,978,980,982,984,986,989,991,993],{"class":83,"style":84},[81,943,265],{"style":91},[81,945,312],{"style":91},[81,947,268],{"style":91},[81,949,317],{"style":98},[81,951,320],{"style":87},[81,953,323],{"style":91},[81,955,326],{"style":287},[81,957,361],{"style":87},[81,959,690],{"style":98},[81,961,962],{"style":87},"(dto)",[81,964,233],{"style":91},[81,966,967],{"style":98}," Json",[81,969,355],{"style":87},[81,971,972],{"style":98},"LoginDto",[81,974,975],{"style":87},">) ",[81,977,284],{"style":91},[81,979,352],{"style":98},[81,981,355],{"style":87},[81,983,690],{"style":98},[81,985,355],{"style":87},[81,987,988],{"style":98},"TokenResponse",[81,990,560],{"style":87},[81,992,700],{"style":98},[81,994,370],{"style":87},[81,996,997,1000,1003,1005,1008,1010,1013,1015,1018,1020,1022,1025,1027],{"class":83,"style":84},[81,998,999],{"style":91},"        let",[81,1001,1002],{"style":87}," user ",[81,1004,92],{"style":91},[81,1006,1007],{"style":287}," self",[81,1009,382],{"style":91},[81,1011,1012],{"style":87},"auth",[81,1014,382],{"style":91},[81,1016,1017],{"style":98},"validate",[81,1019,320],{"style":87},[81,1021,323],{"style":91},[81,1023,1024],{"style":87},"dto)",[81,1026,740],{"style":91},[81,1028,117],{"style":87},[81,1030,1031,1033,1036,1038,1040,1042,1044,1046,1049,1052,1054,1057,1059,1062,1064],{"class":83,"style":84},[81,1032,999],{"style":91},[81,1034,1035],{"style":87}," token ",[81,1037,92],{"style":91},[81,1039,1007],{"style":287},[81,1041,382],{"style":91},[81,1043,1012],{"style":87},[81,1045,382],{"style":91},[81,1047,1048],{"style":98},"login",[81,1050,1051],{"style":87},"(user",[81,1053,382],{"style":91},[81,1055,1056],{"style":87},"id, ",[81,1058,323],{"style":91},[81,1060,1061],{"style":87},"user",[81,1063,382],{"style":91},[81,1065,840],{"style":87},[81,1067,1068,1071,1074,1076,1079,1082,1084,1087,1089,1092,1094,1097,1099,1101],{"class":83,"style":84},[81,1069,1070],{"style":91},"            .",[81,1072,1073],{"style":98},"map_err",[81,1075,320],{"style":87},[81,1077,1078],{"style":91},"|",[81,1080,1081],{"style":87},"_",[81,1083,1078],{"style":91},[81,1085,1086],{"style":98}," HttpError",[81,1088,202],{"style":91},[81,1090,1091],{"style":98},"unauthorized",[81,1093,320],{"style":87},[81,1095,1096],{"style":647},"\"cannot issue token\"",[81,1098,743],{"style":87},[81,1100,396],{"style":91},[81,1102,117],{"style":87},[81,1104,1105,1107,1109,1111,1113,1115],{"class":83,"style":84},[81,1106,375],{"style":98},[81,1108,320],{"style":87},[81,1110,690],{"style":98},[81,1112,320],{"style":87},[81,1114,988],{"style":98},[81,1116,1117],{"style":87}," { token }))",[81,1119,1120],{"class":83,"style":84},[81,1121,303],{"style":87},[81,1123,1124],{"class":83,"style":84},[81,1125,244],{"style":87},[62,1127,40],{"id":39},[1129,1130,1131,1146],"ul",{},[1132,1133,1134,1135,1139,1140,1143,1144,382],"li",{},"There is ",[1136,1137,1138],"strong",{},"no"," ",[53,1141,1142],{},"JwtAuthGuard"," type — the guard is ",[53,1145,597],{},[1132,1147,1148,1149,1151,1152,1155,1156,1161],{},"Guard metadata flows into the OpenAPI spec automatically: guarded routes get a ",[53,1150,783],{}," response and the ",[53,1153,1154],{},"bearer"," security scheme (see ",[1157,1158,1160],"a",{"href":1159},"\u002Fdocs\u002Ffundamentals\u002Fopenapi-swagger","OpenAPI & Swagger",").",[62,1163,43],{"id":42},[1129,1165,1166,1173],{},[1132,1167,1168,1172],{},[1157,1169,1171],{"href":1170},"\u002Fdocs\u002Ftechniques\u002Foauth2-oidc","OAuth2 & OIDC"," — social login that mints the same JWT flavor.",[1132,1174,1175,382],{},[1157,1176,1178],{"href":1177},"\u002Fdocs\u002Foverview\u002Fguards","Guards",{"title":12,"searchDepth":13,"depth":14,"links":1180},[1181,1182,1183,1186,1187,1188,1189,1190],{"id":17,"depth":13,"text":18},{"id":20,"depth":13,"text":21},{"id":23,"depth":13,"text":24,"children":1184},[1185],{"id":27,"depth":14,"text":28},{"id":30,"depth":13,"text":31},{"id":33,"depth":13,"text":34},{"id":36,"depth":13,"text":37},{"id":39,"depth":13,"text":40},{"id":42,"depth":13,"text":43},"https:\u002F\u002Fgithub.com\u002Fj4flmao\u002Fferrite_rs\u002Fedit\u002Fmain\u002Fdocs\u002Fcontent\u002Ftechniques\u002Fauthentication.md",{"title":1193,"slug":1194},"Database (ORM)","techniques\u002Fdatabase",{"title":1171,"slug":1196},"techniques\u002Foauth2-oidc",1789565439198]