Skip to content

Better Auth Flow #47

@kyleoneill

Description

@kyleoneill

Currently any endpoint that requires a logged in user has to begin with

    let user = match get_user_from_auth_header(&app_state.db, &headers, &app_state.config.app_secret).await {
        Ok(user) => user,
        Err(e) => return e.into(),
    };

A second check has to be made if the endpoint would require admin auth

    if user.auth_level != AuthLevel::Admin {
        return ReturnData::forbidden("Can't do that".to_owned());
    }

Is there middleware or something which can make this flow more DRY?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions