kaobei.opendata icon indicating copy to clipboard operation
kaobei.opendata copied to clipboard

使用者新增 TOKEN、使用 API TOKEN

Open Kantai235 opened this issue 5 years ago • 2 comments

使用者資料表新增 api_token(64) 新增 API TOKEN,以便後續 API 的介接

Kantai235 avatar Aug 01 '19 14:08 Kantai235

建議執行步驟:

  1. 瞭解 Laravel 的 資料庫遷移 這件事,並且嘗試讓 users 這張資料表新增 api_token 這個欄位,欄位的屬性為 string(64)
  2. 使用者在註冊會員時,要賦予使用者預設的 API TOKEN,所以要去了解一下 Repository 這件事,建議可以閱讀 這篇文章,或者 這篇文章
  3. 修改 UserRepository,讓使用者在註冊會員時能擁有預設的 API TOKEN
  4. Repository 新增更新 API TOKEN 的方法
  5. 使用者前台修改資訊的地方,提供使用者更新 API TOKEN,但不是給使用者輸入,而是 str_random 亂數產生
  6. 後台使用者的部分,提供管理員更新使用者的 API TOKEN,並且提供管理者輸入,或是 str_random 亂數產生

Kantai235 avatar Aug 01 '19 14:08 Kantai235

看起來很可以,我這周末來看看

LowDensity avatar Aug 01 '19 14:08 LowDensity