Skip to content

Authentication

用於登入/登出等常規驗證操作。

[POST] /api/users/register

用戶註冊。

validation

  • name: required, str:255
  • email: required, str:255, email, unique
  • password: required
  • password_confirmation: required, same as password

request

json
{
	"name": "heel",
	"email": "1234@tt.com",
	"password": "12345678",
	"password_confirmation": "12345678"
}

response

json
{
	"data": {
		"name": "h11eel",
		"email": "1311311111@tt.com",
		"username": "h11eel",
		"updated_at": "2024-06-29T15:52:36.000000Z",
		"created_at": "2024-06-29T15:52:36.000000Z",
		"id": 1
	},
	"token": "1|mo4s3ZcK2xSO1b9yZ1z6e6j70mltcikFuLeJ0bpa311f5446"
}

[POST] /api/users/login

用戶登入。

validation

  • email: required
  • password: required

request

json
{
	"email": "dsfsdf@tt.com",
	"password": "12345678"
}

response

json
{
	"data": {
		"id": 1,
		"name": "h11eel",
		"username": "yish",
		"email": "1311311111@tt.com",
		"email_verified_at": null,
		"two_factor_secret": null,
		"two_factor_recovery_codes": null,
		"created_at": "2024-06-29T15:52:36.000000Z",
		"updated_at": "2024-06-29T15:52:36.000000Z"
	},
	"token": "2|kJUBMsIjDqNCRIYCSiKVgr3hf3xshhRrSln6lIQD27ec4dae"
}

[POST][auth] /api/users/logout

用戶登出,revoke token。

request

json
{
	"email": "dsfsdf@tt.com",
	"password": "12345678"
}

response

HTTP_NO_CONTENT = 204