feat: add json api token generation

This commit is contained in:
DJMrTV 2025-06-06 11:33:16 +02:00
commit a267fbd5e3
4 changed files with 18 additions and 0 deletions

1
src/json_api/mod.rs Normal file
View file

@ -0,0 +1 @@
pub mod oauth;

View file

@ -0,0 +1,14 @@
use rocket::{get, State};
use crate::account::account::Auth;
use crate::nnid::oauth::generate_token::create_token;
use crate::nnid::oauth::generate_token::token_type::AUTH_TOKEN;
use crate::Pool;
#[get("/api/v2/oauth2/generate_token")]
pub async fn generate_token(pool: &State<Pool>, auth: Auth<true>) -> String{
let pool = pool.inner();
create_token(pool, auth.pid, AUTH_TOKEN, None).await
}

View file

@ -0,0 +1 @@
pub mod generate_token;