MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / login

Method login

chirpstack/src/api/internal.rs:144–158  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::LoginRequest>,
    )

Source from the content-addressed store, hash-verified

142#[tonic::async_trait]
143impl InternalService for Internal {
144 async fn login(
145 &self,
146 request: Request<api::LoginRequest>,
147 ) -> Result<Response<api::LoginResponse>, Status> {
148 let req = request.get_ref();
149 let u = user::get_by_email_and_pw(&req.email, &req.password)
150 .await
151 .map_err(|e| e.status())?;
152
153 let token = claims::AuthClaim::new_for_user(&u.id)
154 .encode(self.jwt_secret.as_ref())
155 .map_err(|e| e.status())?;
156
157 Ok(Response::new(api::LoginResponse { jwt: token }))
158 }
159
160 async fn profile(
161 &self,

Callers 2

SessionStoreClass · 0.80
onFinishFunction · 0.80

Calls 4

get_by_email_and_pwFunction · 0.85
statusMethod · 0.80
as_refMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected