pub struct HttpNpmAuthProvider { /* private fields */ }Expand description
HTTP client that verifies npm access tokens.
Usage:
ⓘ
let provider = HttpNpmAuthProvider::new();
let profile = provider.verify_token("npm_abc123").await?;
println!("Authenticated as: {}", profile.login);Implementations§
Source§impl HttpNpmAuthProvider
impl HttpNpmAuthProvider
pub fn new() -> Self
Sourcepub async fn verify_token(
&self,
token: &str,
) -> Result<PlatformUserProfile, PlatformError>
pub async fn verify_token( &self, token: &str, ) -> Result<PlatformUserProfile, PlatformError>
Verifies an npm access token and returns the username.
Args:
token: npm access token (created at https://www.npmjs.com/settings/~/tokens)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HttpNpmAuthProvider
impl !RefUnwindSafe for HttpNpmAuthProvider
impl Send for HttpNpmAuthProvider
impl Sync for HttpNpmAuthProvider
impl Unpin for HttpNpmAuthProvider
impl UnsafeUnpin for HttpNpmAuthProvider
impl !UnwindSafe for HttpNpmAuthProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more