Authentication API v1.0.0
API for user authentication and JWT token issuance.
Base URLs:
POST /auth/token
Issue JWT Token
Issues a JWT access token for authenticated users.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | MailPasswordLoginReqBody | true | Login payload with email and password |
Code samples
- shell
- http
- javascript
- ruby
- python
- php
- java
- go
curl -X POST https://fridgebridge.simplecharity.com/auth/token \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST https://fridgebridge.simplecharity.com/auth/token HTTP/1.1
Host: fridgebridge.simplecharity.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"mail": "user@example.com",
"password": "securepassword123"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('https://fridgebridge.simplecharity.com/auth/token',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post 'https://fridgebridge.simplecharity.com/auth/token',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('https://fridgebridge.simplecharity.com/auth/token', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://fridgebridge.simplecharity.com/auth/token', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://fridgebridge.simplecharity.com/auth/token");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://fridgebridge.simplecharity.com/auth/token", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | JWT token issued successfully. | ApiResponseWithToken |
400 | Bad Request | Invalid request body or missing parameters. | ApiResponse |
401 | Unauthorized | Unauthorized access. | ApiResponse |
500 | Internal Server Error | Internal server error. | ApiResponse |
Example responses
- 200 Response
{
"status": 200,
"data": {
"access-token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsIm93bmVyX2lkIjoiMTIzNCIsInR5cGUiOiJsZWdhbCIsImV4cCI6MTYzMDYyMzAwMH0.abcdefg12345"
}
}
Schemas
MailPasswordLoginReqBody
{
"mail": "user@example.com",
"password": "securepassword123"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
string(email) | true | none | none | |
password | string | true | none | none |
ApiResponse
{
"status": 200,
"message": "Success"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
status | integer | false | none | none |
message | string | false | none | none |
ApiResponseWithToken
{
"status": 200,
"data": {
"access-token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsIm93bmVyX2lkIjoiMTIzNCIsInR5cGUiOiJsZWdhbCIsImV4cCI6MTYzMDYyMzAwMH0.abcdefg12345"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
status | integer | false | none | none |
data | object | false | none | none |
» access-token | string | false | none | none |