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
Optional extractors are done using Option<T> in the handler parameters where you'd put your extractor (T) usually.
In your case that not all routes require auth, then consider only applying the middleare to those that do need it using Scope::wrap or Resource::wrap instead of App::wrap.
Expected Behavior
Set
Authorization
header optional.Current Behavior
If I don’t send the
Authorization
header, the extractor fail and returns a 401 error.Possible Solution
Impl
AuthExtrator
forOption<BasicAuth>
andOption<BearerAuth>
.Context
Some routes aren’t require authentication, typically route for registration/sign in.
Your Environment
rustc -V
): rustc 1.48.0 (7eac88abb 2020-11-16)The text was updated successfully, but these errors were encountered: