B2COPY API は bearer-token 認証を使用します。以下のサインイン メソッドを呼び出してアクセス/リフレッシュ トークンのペアを取得し、後続のすべての要求の Authorization: Bearer <token> ヘッダーにアクセス トークンを含めます。
前提条件
トークンを取得するには、すでに Back Office に登録されており、それにアクセスするための資格情報を持っている必要があります。
終点
POST [host]/api/v2/signinリクエストボディ
| 名前 | タイプ | 必須 | 説明 |
|---|---|---|---|
| string | Yes | The email address used to access the Back Office. | |
| password | string | Yes | The password used to access the Back Office. |
curl --location --request POST 'https://host.name/api/v2/signin' \
--data-raw '{
"email": "[email protected]",
"password": "Secret123"
}'応答
応答はアクセス トークンとリフレッシュ トークンのペアを返し、それぞれにトークン文字列と createdAt / expiresAt タイムスタンプが含まれます。
{
"2faRequired": false,
"accessToken": {
"token": "eyJ0eXAiOiJKV1Qi…",
"createdAt": "2024-01-01T00:00:00+00:00",
"expiresAt": "2024-01-01T00:00:00+00:00"
},
"refreshToken": {
"token": "eyJ0eXAiOiJKV1Qi…",
"createdAt": "2024-01-01T00:00:00+00:00",
"expiresAt": "2024-01-01T00:00:00+00:00"
}
}