SHA256にした

This commit is contained in:
syuilo 2017-02-08 22:43:46 +09:00
parent 13ef9f6e6f
commit 2b1cbcc8bf
2 changed files with 4 additions and 4 deletions

View file

@ -71,6 +71,6 @@ block content
br
| 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます!
p
| 以降アクセストークンは、<strong>ユーザーのアクセストークン+アプリのシークレットキーをsha512したもの</strong>として扱います。
| 以降アクセストークンは、<strong>ユーザーのアクセストークン+アプリのシークレットキーをsha256したもの</strong>として扱います。
p アクセストークンを取得できたら、あとは簡単です。REST APIなら、リクエストにアクセストークンを<code>i</code>としてパラメータに含めるだけです。

View file

@ -72,9 +72,9 @@ module.exports = (params, user) =>
});
// Generate Hash
const sha512 = crypto.createHash('sha512');
sha512.update(token + app.secret);
const hash = sha512.digest('hex');
const sha256 = crypto.createHash('sha256');
sha256.update(token + app.secret);
const hash = sha256.digest('hex');
// Insert access token doc
await AccessToken.insert({