Authorization endpoints
This document contains the endpoints for the Authorization category.
Generates a token
/api/v1/auth/token
Authorized
This endpoint generates a token
Parameters
Name
Type
In
Required
Description
login
object
body
optional
Body
Schema
{
"email" : "string" ,
"password" : "string"
}
Request examples
/v1/auth/token
Authorized
curl --location 'http://localhost/api/v1/auth/token'
--header 'Authorization ••••••'
--header 'Content-Type: application/json'
--data '{
"email": "string",
"password": "string"
}'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "http://localhost/api/v1/auth/token" );
request . Headers . Add ( "Authorization" , "••••••" );
request . Headers . Add ( "Content-Type" , "application/json" );
request . Content = new StringContent ( "{
"email" : "string" ,
"password" : "string"
} ");
request . Content = content ;
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/token"
method := "post"
payload := strings . NewReader ( `{
"email": "string",
"password": "string"
}` )
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Responses
{
"email" : "string" ,
"expires_at" : "int64" ,
"token" : "string"
}
{
"code" : "int" ,
"message" : "string" ,
"stack" : [
{
"code" : "int" ,
"description" : "string" ,
"error" : "string" ,
"path" : "string"
}
]
}
{
"error" : "OAuthErrorType" ,
"error_description" : "string" ,
"error_uri" : "string"
}
Validates a token
/api/v1/auth/token/validate
Authorized
This endpoint validates a token
Parameters
Name
Type
In
Required
Description
tokenRequest
object
body
optional
Body
Request examples
/v1/auth/token/validate
Authorized
curl --location 'http://localhost/api/v1/auth/token/validate'
--header 'Authorization ••••••'
--header 'Content-Type: application/json'
--data '{
"token": "string"
}'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "http://localhost/api/v1/auth/token/validate" );
request . Headers . Add ( "Authorization" , "••••••" );
request . Headers . Add ( "Content-Type" , "application/json" );
request . Content = new StringContent ( "{
"token" : "string"
} ");
request . Content = content ;
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/auth/token/validate"
method := "post"
payload := strings . NewReader ( `{
"token": "string"
}` )
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Responses
{
"code" : "int" ,
"message" : "string" ,
"stack" : [
{
"code" : "int" ,
"description" : "string" ,
"error" : "string" ,
"path" : "string"
}
]
}
{
"error" : "OAuthErrorType" ,
"error_description" : "string" ,
"error_uri" : "string"
}