pub async fn create_token(mut req: LnxRequest) -> LnxResponse {
    let body: CreateTokenPayload = json!(req.body_mut());
    let state = req.data::<State>().expect("get state");

    let data = state.auth.create_token(
        body.permissions,
        body.user,
        body.description,
        body.allowed_indexes,
    );

    let storage = state.storage.clone();
    state.auth.commit(storage).await?;

    json_response(200, data.as_ref())
}
/// Creates a new access token with 64 characters.
///
/// Each token can have the following metadata associated to it:
/// - permissions*
/// - user
/// - description
/// - allowed_indexes
///
/// `*` - Required.
Creates a new access token with 64 characters.
Each token can have the following metadata associated to it:
permissions
user
description
allowed_indexes


Creates a new access token with 64 characters . Each token can have the following metadata associated to it : permissions user description allowed_indexes
pub async fn create_token(mut req: LnxRequest) -> LnxResponse {
    let body: CreateTokenPayload = json!(req.body_mut());
    let state = req.data::<State>().expect("get state");
    let data = state.auth.create_token(
        body.permissions,
        body.user,
        body.description,
        body.allowed_indexes,
    );
    let storage = state.storage.clone();
    state.auth.commit(storage).await?;
    json_response(200, data.as_ref())
}
pub async fn create_token ( mut req : LnxRequest ) -> LnxResponse { let body : CreateTokenPayload = json ! ( req body_mut ( ) ) ; let state = req . data :: < State > ( ) . expect ( " " ) ; let data = state . auth . create_token ( body . permissions , body . user , body . description , body . allowed_indexes , ) ; let storage = state . storage . clone ( ) ; state . auth . commit ( storage ) . await ? ; json_response ( 200 , data . as_ref ( ) ) }
Creates a new access token with 64 characters.
Creates a new access token with 64 characters .
req
LnxRequest
req
LnxRequest