5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails トークンとは

5
Last updated at Posted at 2016-08-05

トークンとは

ワンタイムパスワードのこと(定義としては)
カード型のハードトークンやPCにインストールして利用するソフトトークンがある。

DEVISEなどの、ユーザ認証のためのメールに記載されている、

"こちらをクリックして登録を完了してください。"

が、ワンタイムパスワード(有効化トークン、ワンタイムトークンURLとも言われたりする)。
通常、有効なのは1回だけで、期限がある(24h以内など)。プログラミングでは、ソースコードを解析する際にそれ以上細かい単位に分解できない文字列の並びの最小単位(要素名や演算子)のことをトークンという。

・具体例
DEVISEの場合

  1. ユーザがsign_up(新規登録)をした際に、トークン(ワンタイムパスワード)が生成・発行される。
  2. ユーザ認証のためのメールに記載されている、

"こちらをクリックして登録を完了してください(が、トークン、及びワンタイムパスワードに該当する)。"

をクリックすることにより、ソースコードを解析する際にそれ以上細かい単位に分解できない文字列の並びの最小単位(要素名や演算子)が、tableのカラムに登録される。
以下はusersテーブルのconfirmation_tokenカラム。

confirmation_token
eTy27W6bSdJPsNnQ2H-d

参考サイト
http://rails.takayukikoyama.com/login-logout/temporary-onetime-token/
http://qa.atmarkit.co.jp/q/2755

5
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?