Gửi thông tin đăng nhập vào luồng login
Gửi thông tin đăng nhập vào luồng login
curl --request POST \
--url https://api-gw.verolabs.co/api/authen/self-service/login \
--header 'Content-Type: application/json' \
--data '
{
"method": "password",
"csrf_token": "<string>",
"password_identifier": "jsmith@example.com",
"password": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
method: 'password',
csrf_token: '<string>',
password_identifier: 'jsmith@example.com',
password: '<string>'
})
};
fetch('https://api-gw.verolabs.co/api/authen/self-service/login', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-gw.verolabs.co/api/authen/self-service/login"
payload = {
"method": "password",
"csrf_token": "<string>",
"password_identifier": "jsmith@example.com",
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-gw.verolabs.co/api/authen/self-service/login"
payload := strings.NewReader("{\n \"method\": \"password\",\n \"csrf_token\": \"<string>\",\n \"password_identifier\": \"jsmith@example.com\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api-gw.verolabs.co/api/authen/self-service/login");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n \"method\": \"password\",\n \"csrf_token\": \"<string>\",\n \"password_identifier\": \"jsmith@example.com\",\n \"password\": \"<string>\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);falseCURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-gw.verolabs.co/api/authen/self-service/login");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"method\": \"password\",\n \"csrf_token\": \"<string>\",\n \"password_identifier\": \"jsmith@example.com\",\n \"password\": \"<string>\"\n}");
CURLcode ret = curl_easy_perform(hnd);{
"session_token": "<string>",
"session": {
"id": "<string>",
"active": true,
"identity": {
"id": "<string>",
"traits": {},
"schema_id": "<string>",
"schema_url": "<string>",
"state": "<string>",
"state_changed_at": "2023-11-07T05:31:56Z",
"recovery_addresses": [
{}
],
"metadata_public": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"organization_id": "<string>"
},
"tokenized": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"authenticated_at": "2023-11-07T05:31:56Z",
"authenticator_assurance_level": "<string>",
"authentication_methods": [
{
"method": "<string>",
"aal": "<string>",
"completed_at": "2023-11-07T05:31:56Z"
}
],
"issued_at": "2023-11-07T05:31:56Z",
"devices": [
{
"id": "<string>",
"ip_address": "<string>",
"user_agent": "<string>",
"location": "<string>"
}
]
},
"identity": {}
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}Tham số truy vấn
Ma flow duoc tra ve tu endpoint tao flow tuong ung. Khi submit/update flow phai truyen dung ma nay trong query flow.
Nội dung
Payload cap nhat self-service flow. Truyen ma flow tren query string va gui cac field bat buoc cua method dang dung.
JSON payload dung de submit thong tin dang nhap bang mat khau vao login flow.
Phuong thuc xac thuc. Client gui password khi dang nhap bang mat khau.
password CSRF token lay tu UI node cua login flow khi he thong yeu cau.
Dinh danh dang nhap cua user. Ung dung gui email tai khoan.
Mat khau dang plain text do user nhap. Chi gui qua HTTPS.
Phản hồi
Dang nhap thanh cong. Ung dung doc session_token trong payload nay va dung no lam token phien dang nhap.
Response tra ve sau khi API login flow thanh cong.
Bearer/session token client dung cho cac API can dang nhap.
session object cua identity da dang nhap.
Hide child attributes
Hide child attributes
Ma session.
Cho biet session hien co dang active hay khong.
identity da dang nhap, gom id, schema metadata, state, traits, recovery addresses va timestamps.
Hide child attributes
Hide child attributes
Ma identity cua user da dang nhap.
Thuoc tinh ho so identity luu tren he thong, vi du email va name.
Ma identity schema.
URL cua identity schema.
Trang thai identity, vi du active.
Thoi diem trang thai identity thay doi lan cuoi.
Danh sach recovery address cau hinh tren identity.
Metadata public cua identity do he thong tra ve; co the null.
Thoi diem tao identity.
Thoi diem cap nhat identity.
Ma organization neu identity thuoc organization; null neu khong co.
Bearer token tra ve khi truyen tokenize_as va tra tokenized session.
Thoi diem session het han.
Thoi diem user xac thuc cho session nay.
Muc dam bao xac thuc cua session, vi du aal1.
Cac phuong thuc xac thuc da hoan tat cho session.
Thoi diem he thong phat hanh session.
Metadata thiet bi/session do he thong tra ve, gom device id, IP address, user agent va location.
identity object, gom identity id va traits khi tra ve.
curl --request POST \
--url https://api-gw.verolabs.co/api/authen/self-service/login \
--header 'Content-Type: application/json' \
--data '
{
"method": "password",
"csrf_token": "<string>",
"password_identifier": "jsmith@example.com",
"password": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
method: 'password',
csrf_token: '<string>',
password_identifier: 'jsmith@example.com',
password: '<string>'
})
};
fetch('https://api-gw.verolabs.co/api/authen/self-service/login', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-gw.verolabs.co/api/authen/self-service/login"
payload = {
"method": "password",
"csrf_token": "<string>",
"password_identifier": "jsmith@example.com",
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-gw.verolabs.co/api/authen/self-service/login"
payload := strings.NewReader("{\n \"method\": \"password\",\n \"csrf_token\": \"<string>\",\n \"password_identifier\": \"jsmith@example.com\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api-gw.verolabs.co/api/authen/self-service/login");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n \"method\": \"password\",\n \"csrf_token\": \"<string>\",\n \"password_identifier\": \"jsmith@example.com\",\n \"password\": \"<string>\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);falseCURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-gw.verolabs.co/api/authen/self-service/login");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"method\": \"password\",\n \"csrf_token\": \"<string>\",\n \"password_identifier\": \"jsmith@example.com\",\n \"password\": \"<string>\"\n}");
CURLcode ret = curl_easy_perform(hnd);{
"session_token": "<string>",
"session": {
"id": "<string>",
"active": true,
"identity": {
"id": "<string>",
"traits": {},
"schema_id": "<string>",
"schema_url": "<string>",
"state": "<string>",
"state_changed_at": "2023-11-07T05:31:56Z",
"recovery_addresses": [
{}
],
"metadata_public": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"organization_id": "<string>"
},
"tokenized": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"authenticated_at": "2023-11-07T05:31:56Z",
"authenticator_assurance_level": "<string>",
"authentication_methods": [
{
"method": "<string>",
"aal": "<string>",
"completed_at": "2023-11-07T05:31:56Z"
}
],
"issued_at": "2023-11-07T05:31:56Z",
"devices": [
{
"id": "<string>",
"ip_address": "<string>",
"user_agent": "<string>",
"location": "<string>"
}
]
},
"identity": {}
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}{
"error": "<string>",
"message": "<string>",
"detail": "<string>",
"details": "<string>",
"status": 123
}
