docs(api): auth endpoints in bruno

This commit is contained in:
2025-09-22 22:38:48 -05:00
parent 4cc990f52f
commit bc1cbbad2e
6 changed files with 117 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ meta {
} }
get { get {
url: http://{{url}}/lst/api/me url: http://{{url}}/lst/api/user/me
body: none body: none
auth: inherit auth: inherit
} }

View File

@@ -0,0 +1,24 @@
meta {
name: Get Users
type: http
seq: 7
}
post {
url: http://{{url}}/lst/api/admin/users
body: none
auth: inherit
}
body:json {
{
"username":"matthes01",
"name":"blake",
"email":"blake.matthes@alpla.com",
"password":"nova0511"
}
}
settings {
encodeUrl: true
}

View File

@@ -0,0 +1,26 @@
meta {
name: GrantROle by ID
type: http
seq: 8
}
post {
url: http://{{url}}/lst/api/admin/:userID/grant
body: json
auth: inherit
}
params:path {
userID: 0hlO48C7Jw1J804FxrCnonK
}
body:json {
{
"module":"users",
"role":"admin"
}
}
settings {
encodeUrl: true
}

View File

@@ -5,16 +5,16 @@ meta {
} }
post { post {
url: http://{{url}}/lst/api/register url: http://{{url}}/lst/api/user/register
body: json body: json
auth: inherit auth: inherit
} }
body:json { body:json {
{ {
"username":"matthes01", "username":"matthes011",
"name":"blake", "name":"blake",
"email":"blake.matthes@alpla.com", "email":"blake1.matthes@alpla.com",
"password":"nova0511" "password":"nova0511"
} }
} }

View File

@@ -0,0 +1,35 @@
meta {
name: Session
type: http
seq: 5
}
get {
url: http://{{url}}/lst/api/auth/get-session
body: none
auth: inherit
}
body:json {
{
"username": "matthes01",
"password": "nova0511"
}
}
script:post-response {
// grab the raw Set-Cookie header
const cookies = res.headers["set-cookie"];
// cookies is usually an array, e.g. ["auth_session=abcd123; Path=/; HttpOnly; Secure; SameSite=Lax"]
// Extract just the value part ("auth_session=abcd123")
const sessionCookie = cookies[0].split(";")[0];
// Save it as an environment variable
bru.setEnvVar("session_cookie", sessionCookie);
}
settings {
encodeUrl: true
}

View File

@@ -0,0 +1,28 @@
meta {
name: Signout
type: http
seq: 6
}
post {
url: http://{{url}}/lst/api/auth/sign-out
body: none
auth: inherit
}
body:json {
{
"username": "matthes01",
"password": "nova0511"
}
}
script:post-response {
// Save it as an environment variable
bru.setEnvVar("session_cookie", null);
}
settings {
encodeUrl: true
}