Get current session
const options = {method: 'GET'};
fetch('http://localhost:8000/v1/auth/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/auth/session"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request GET \
--url http://localhost:8000/v1/auth/sessionimport requests
url = "http://localhost:8000/v1/auth/session"
response = requests.get(url)
print(response.text){
"success": true,
"data": {
"session": {
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"image": "<string>",
"emailVerified": true,
"createdAt": "2023-11-07T05:31:56Z",
"role": "<string>"
},
"currentOrganization": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"logo": "<string>",
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"organizationMemberships": [
{
"organizationId": "<string>",
"organizationName": "<string>",
"organizationSlug": "<string>",
"role": "owner"
}
]
},
"meta": {
"requestId": "<string>",
"timestamp": "<string>"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "<string>",
"timestamp": "<string>"
}
}Session
Get current session
Returns the current session with user details and organization context
GET
/
v1
/
auth
/
session
Get current session
const options = {method: 'GET'};
fetch('http://localhost:8000/v1/auth/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/auth/session"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request GET \
--url http://localhost:8000/v1/auth/sessionimport requests
url = "http://localhost:8000/v1/auth/session"
response = requests.get(url)
print(response.text){
"success": true,
"data": {
"session": {
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"image": "<string>",
"emailVerified": true,
"createdAt": "2023-11-07T05:31:56Z",
"role": "<string>"
},
"currentOrganization": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"logo": "<string>",
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"organizationMemberships": [
{
"organizationId": "<string>",
"organizationName": "<string>",
"organizationSlug": "<string>",
"role": "owner"
}
]
},
"meta": {
"requestId": "<string>",
"timestamp": "<string>"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "<string>",
"timestamp": "<string>"
}
}Was this page helpful?