{"id":7869,"date":"2017-05-20T17:21:17","date_gmt":"2017-05-20T08:21:17","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=7869"},"modified":"2020-03-20T18:05:35","modified_gmt":"2020-03-20T09:05:35","slug":"rails5-devise-token-auth%e3%81%a7%e4%bd%9c%e3%82%8b-%e8%aa%8d%e8%a8%bcapi","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=7869","title":{"rendered":"Rails5 + devise token auth\u3067\u4f5c\u308b \u8a8d\u8a3cAPI"},"content":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002<\/p>\n<p>\u3061\u3087\u3063\u3068Rails\u306e\u8a8d\u8a3c\u5468\u308a\u306b\u3064\u3044\u3066\u5c11\u3005\u3002<\/p>\n<p>\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3067\u8a8d\u8a3c\u304c\u5fc5\u8981\u306a\u5834\u5408\u3001\u5927\u304d\u304f2\u3064\u306e\u5b9f\u88c5\u65b9\u6cd5\u304c\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30fb<strong>Cookie\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c<\/strong><\/p>\n<p>\u30fb<strong>Token\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-7871\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/cookie-token-auth.png\" alt=\"\" width=\"615\" height=\"350\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/cookie-token-auth.png 950w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/cookie-token-auth-300x171.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/cookie-token-auth-768x437.png 768w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/p>\n<p>\u4eca\u56de\u306f\u3001<strong>Token\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c<\/strong>\u306b\u3064\u3044\u3066\u884c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>Ruby oc Rails<\/strong>\u3092\u57fa\u306b\u69cb\u7bc9\u3057\u3001<strong>Cookie\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c<\/strong>\u3092\u884c\u3046\u5834\u5408\u3001\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3084\u3001\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u5468\u308a\u3092 Gem\u3067\u3042\u308bdevise\u306b\u304a\u4efb\u305b\u3059\u308b\u3053\u3068\u3082\u591a\u3005\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3093\u306a\u3001devise\u3092\u4f7f\u3063\u3066\u3001\u30c8\u30fc\u30af\u30f3\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u300c<strong>devise token auth<\/strong> \u300d\u3068\u3044\u3046Gem\u3092\u4f7f\u3046\u3068\u3001\u4f55\u304b\u3068\u5bb9\u6613\u306b\u5b9f\u88c5\u304c\u884c\u3048\u307e\u3059\u306e\u3067\u3001\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7874\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/logo.jpg\" alt=\"\" width=\"650\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/logo.jpg 800w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/logo-300x188.jpg 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/logo-768x480.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<h4>\u6e96\u5099<\/h4>\n<p>\u305d\u308c\u3067\u306f\u3001\u65e9\u901f\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001rails new \u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails new app_name --api -d mysql<\/pre>\n<p>\u7d9a\u3044\u3066\u3001Gemfile\u3092\u7de8\u96c6\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u65b0\u305f\u306b\u3001\u300c<strong>devise<\/strong>\u300d\u3068\u300c<strong>devise_token_auth<\/strong>\u300d\u3092\u8ffd\u52a0\u3057\u3001\u300c<strong>jbuilder<\/strong>\u300d\u3068\u3001\u300c<strong>rack-cors<\/strong>\u300d\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Gemfile<\/strong><\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">source 'https:\/\/rubygems.org'\r\n\r\ngit_source(:github) do |repo_name|\r\nrepo_name = &quot;#{repo_name}\/#{repo_name}&quot; unless repo_name.include?(&quot;\/&quot;)\r\n&quot;https:\/\/github.com\/#{repo_name}.git&quot;\r\nend\r\n\r\n# Bundle edge Rails instead: gem 'rails', github: 'rails\/rails'\r\ngem 'rails', '~&gt; 5.0.2'\r\n# Use mysql as the database for Active Record\r\ngem 'mysql2', '&gt;= 0.3.18', '&lt; 0.5'\r\n# Use Puma as the app server\r\ngem 'puma', '~&gt; 3.0'\r\n\r\n# json\u3092\u6271\u3046\u305f\u3081\u306egem\r\n# Build JSON APIs with ease. Read more: https:\/\/github.com\/rails\/jbuilder\r\ngem 'jbuilder', '~&gt; 2.5'\r\n# Use Redis adapter to run Action Cable in production\r\n# gem 'redis', '~&gt; 3.0'\r\n# Use ActiveModel has_secure_password\r\n# gem 'bcrypt', '~&gt; 3.1.7'\r\n\r\n# Use Capistrano for deployment\r\n# gem 'capistrano-rails', group: :development\r\n\r\n# \u30af\u30ed\u30b9\u30c9\u30e1\u30a4\u30f3\u5bfe\u7b56\r\n# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible\r\ngem 'rack-cors'\r\n\r\n# \u30c8\u30fc\u30af\u30f3\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c\u3092\u884c\u3046\r\ngem 'devise'\r\ngem 'devise_token_auth'\r\n\r\ngroup :development, :test do\r\n# Call 'byebug' anywhere in the code to stop execution and get a debugger console\r\ngem 'byebug', platform: :mri\r\nend\r\n\r\ngroup :development do\r\ngem 'listen', '~&gt; 3.0.5'\r\n# Spring speeds up development by keeping your application running in the background. Read more: https:\/\/github.com\/rails\/spring\r\ngem 'spring'\r\ngem 'spring-watcher-listen', '~&gt; 2.0.0'\r\nend\r\n\r\n# Windows does not include zoneinfo files, so bundle the tzinfo-data gem\r\ngem 'tzinfo-data', platforms: &#x5B;:mingw, :mswin, :x64_mingw, :jruby]<\/pre>\n<p>gem\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\u3089\u3001bundle install\u3067gem\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e00\u5fdc\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5148\u306e path\u306f\u3001\u300cvendor\/bundle\u300d\u3068\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ bundle install --path vendor\/bundle<\/pre>\n<p>gem\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4f5c\u6210\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ bundle exec rake db:create<\/pre>\n<p>mysql\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u8d77\u52d5\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ mysql.server start<\/pre>\n<p>\u3072\u3068\u307e\u305a\u3001\u6e96\u5099\u306f\u5b8c\u4e86\u3057\u307e\u3057\u305f\u306e\u3067\u3001\u7d9a\u3044\u3066\u306f\u3001\u300c<strong>deveise token auth<\/strong>\u300d\u3092\u7528\u3044\u3066 \u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h4>devise token auth<\/h4>\n<p>rails g \u30b3\u30de\u30f3\u30c9\u3067\u300cdeveise_token_auth\u300d\u304c\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067 User\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails g devise_token_auth:install User auth<\/pre>\n<p>\u4ee5\u4e0b\u306e\u69d8\u306b\u8868\u793a\u3059\u308c\u3070\u6210\u529f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">create  config\/initializers\/devise_token_auth.rb\r\ncreate  db\/migrate\/20170520062742_devise_token_auth_create_users.rb\r\ncreate  app\/models\/user.rb\r\ninsert  app\/controllers\/application_controller.rb\r\ngsub  config\/routes.rb<\/pre>\n<p>\u5b8c\u4e86\u3059\u308b\u3068\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u7c21\u6613\u7248\u3068\u3044\u3046\u4e8b\u3082\u3042\u3063\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u65b0\u898f\u306b\u767b\u9332\u3059\u308b\u969b\u3001<\/p>\n<p><strong>\u30fb\u540d\u524d<\/strong><\/p>\n<p><strong>\u30fb\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9<\/strong><\/p>\n<p><strong>\u30fb\u6240\u5c5e\u30c1\u30fc\u30e0<\/strong><\/p>\n<p>\u3092\u3001\u767b\u9332\u3067\u304d\u308b\u3088\u3046\u306b\u30ab\u30e9\u30e0\u306e\u6e96\u5099\u3092\u884c\u3063\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001twitter\u3084facebook\u306a\u3069\u306e\u30bd\u30fc\u30b7\u30e3\u30eb\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u3088\u308b\u30ed\u30b0\u30a4\u30f3\u3084\u3001\u767b\u9332\u3059\u308b\u969b\u306b\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u3066\u78ba\u8a8d\u3002\u306a\u3069\u3068\u8a00\u3063\u305f\u6a5f\u80fd\u306b\u95a2\u3057\u3066\u4eca\u56de\u306f\u884c\u308f\u306a\u3044\u306e\u3067\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u30e2\u30c7\u30eb\u3067\u3042\u308b\u3001 user.rb \u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/models\/user.rb<\/strong><\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">class User &lt; ActiveRecord::Base\r\n  # Include default devise modules.\r\n  devise :database_authenticatable, :registerable,\r\n  :recoverable, :rememberable, :trackable, :validatable\r\n  #:confirmable, :omniauthable\r\n  include DeviseTokenAuth::Concerns::User\r\nend<\/pre>\n<p>\u6b21\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u30ab\u30e9\u30e0\u751f\u6210\u306e\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e3b\u306a\u4fee\u6b63\u70b9\u3068\u3057\u3066\u3001\u300c<strong>Confirmable<\/strong>\u300d\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3068\u300c<strong>confirmation_token<\/strong>\u300d\u306e add_index\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3001\u30e6\u30fc\u30b6\u30fc\u30ab\u30e9\u30e0\uff08User Info\uff09\u306b\u300c<strong>\u6240\u5c5e\u30c1\u30fc\u30e0<\/strong>\u300d\u7528\u306e\u30ab\u30e9\u30e0 \u300c<strong>team<\/strong>\u300d\u306e\u8ffd\u52a0\u306e\u8a18\u8ff0\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>db\/migrate\/xxxxxxx_devise_token_auth_create_users.rb<\/strong><\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">class DeviseTokenAuthCreateUsers &lt; ActiveRecord::Migration&#x5B;5.0]\r\n  def change\r\n    create_table(:users) do |t|\r\n      ## Required\r\n      t.string :provider, :null =&gt; false, :default =&gt; &quot;email&quot;\r\n      t.string :uid, :null =&gt; false, :default =&gt; &quot;&quot;\r\n\r\n      ## Database authenticatable\r\n      t.string :encrypted_password, :null =&gt; false, :default =&gt; &quot;&quot;\r\n\r\n      ## Recoverable\r\n      t.string   :reset_password_token\r\n      t.datetime :reset_password_sent_at\r\n\r\n      ## Rememberable\r\n      t.datetime :remember_created_at\r\n\r\n      ## Trackable\r\n      t.integer  :sign_in_count, :default =&gt; 0, :null =&gt; false\r\n      t.datetime :current_sign_in_at\r\n      t.datetime :last_sign_in_at\r\n      t.string   :current_sign_in_ip\r\n      t.string   :last_sign_in_ip\r\n\r\n      ## Confirmable \u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n      # t.string   :confirmation_token\r\n      # t.datetime :confirmed_at\r\n      # t.datetime :confirmation_sent_at\r\n      # t.string   :unconfirmed_email # Only if using reconfirmable\r\n\r\n      ## Lockable\r\n      # t.integer  :failed_attempts, :default =&gt; 0, :null =&gt; false # Only if lock strategy is :failed_attempts\r\n      # t.string   :unlock_token # Only if unlock strategy is :email or :both\r\n      # t.datetime :locked_at\r\n\r\n      ## User Info\r\n      t.string :name\r\n      t.string :nickname\r\n      t.string :image\r\n      t.string :email\r\n      t.string :team\r\n\r\n      ## Tokens\r\n      t.text :tokens\r\n\r\n      t.timestamps\r\n    end\r\n\r\n    add_index :users, :email,                unique: true\r\n    add_index :users, &#x5B;:uid, :provider],     unique: true\r\n    add_index :users, :reset_password_token, unique: true\r\n\r\n    # \u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n    # add_index :users, :confirmation_token,   unique: true\r\n    # add_index :users, :unlock_token,       unique: true\r\n  end\r\nend<\/pre>\n<p>\u3053\u3053\u307e\u3067\u3001\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u30c6\u30fc\u30d6\u30eb\u306e\u751f\u6210\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ bundle exec rake db:migrate<\/pre>\n<p>\u4ee5\u4e0b\u306e\u69d8\u306b\u3001\u5b9f\u884c\u3055\u308c\u308c\u3070\u6210\u529f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">== 20170520062742 DeviseTokenAuthCreateUsers: migrating =======================\r\n-- create_table(:users)\r\n-&gt; 0.0164s\r\n-- add_index(:users, :email, {:unique=&gt;true})\r\n-&gt; 0.0158s\r\n-- add_index(:users, &#x5B;:uid, :provider], {:unique=&gt;true})\r\n-&gt; 0.0126s\r\n-- add_index(:users, :reset_password_token, {:unique=&gt;true})\r\n-&gt; 0.0140s\r\n== 20170520062742 DeviseTokenAuthCreateUsers: migrated (0.0590s) ==============<\/pre>\n<h5>Routes<\/h5>\n<p>\u73fe\u5728\u306e\u30eb\u30fc\u30c8\u306e\u78ba\u8a8d\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rake routes<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Prefix Verb   URI Pattern                    Controller#Action\r\nnew_user_session GET    \/auth\/sign_in(.:format)        devise_token_auth\/sessions#new\r\nuser_session POST   \/auth\/sign_in(.:format)        devise_token_auth\/sessions#create\r\ndestroy_user_session DELETE \/auth\/sign_out(.:format)       devise_token_auth\/sessions#destroy\r\nnew_user_password GET    \/auth\/password\/new(.:format)   devise_token_auth\/passwords#new\r\nedit_user_password GET    \/auth\/password\/edit(.:format)  devise_token_auth\/passwords#edit\r\nuser_password PATCH  \/auth\/password(.:format)       devise_token_auth\/passwords#update\r\nPUT    \/auth\/password(.:format)       devise_token_auth\/passwords#update\r\nPOST   \/auth\/password(.:format)       devise_token_auth\/passwords#create\r\ncancel_user_registration GET    \/auth\/cancel(.:format)         devise_token_auth\/registrations#cancel\r\nnew_user_registration GET    \/auth\/sign_up(.:format)        devise_token_auth\/registrations#new\r\nedit_user_registration GET    \/auth\/edit(.:format)           devise_token_auth\/registrations#edit\r\nuser_registration PATCH  \/auth(.:format)                devise_token_auth\/registrations#update\r\nPUT    \/auth(.:format)                devise_token_auth\/registrations#update\r\nDELETE \/auth(.:format)                devise_token_auth\/registrations#destroy\r\nPOST   \/auth(.:format)                devise_token_auth\/registrations#create\r\nauth_validate_token GET    \/auth\/validate_token(.:format) devise_token_auth\/token_validations#validate_token<\/pre>\n<p>devise_token_auth\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30eb\u30fc\u30c8\u8a2d\u5b9a\u304c\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001user\u306eteam\u304c\u7de8\u96c6\u51fa\u6765\u308b\u3088\u3046\u306b\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u30aa\u30fc\u30d0\u30e9\u30a4\u30c9\u3057\u3066\u300cteam\u300d\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>rails \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30b3\u30de\u30f3\u30c9\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails g controller auth\/registrations<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3089\u3001\u7de8\u96c6\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>app\/controllers\/auth\/registrations_controller.rb<\/strong><\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">module Auth\r\n  class RegistrationsController &lt; DeviseTokenAuth::RegistrationsController\r\n\r\n  private\r\n  def sign_up_params\r\n  params.permit(:name, :email, :team, :password, :password_confirmation)\r\n  end\r\n\r\n  def account_update_params\r\n  params.permit(:name, :email, :team)\r\n  end\r\n\r\n  end\r\nend<\/pre>\n<p>\u7d9a\u3044\u3066\u3001\u30eb\u30fc\u30c8\u3092\u5909\u66f4\u3057\u3001\u5148\u7a0b\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>config\/routes.rb<\/strong><\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">Rails.application.routes.draw do\r\n  mount_devise_token_auth_for 'User', at: 'auth', controllers: {\r\n    registrations: 'auth\/registrations'\r\n  }\r\n  # For details on the DSL available within this file, see http:\/\/guides.rubyonrails.org\/routing.html\r\nend<\/pre>\n<p>rake routes \u30b3\u30de\u30f3\u30c9\u3067\u3001\u5148\u7a0b\u306eauth\/registrations\u306b\u30d1\u30b9\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u305f\u3089\u6210\u529f\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rake routes<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Prefix Verb   URI Pattern                    Controller#Action\r\nnew_user_session GET    \/auth\/sign_in(.:format)        devise_token_auth\/sessions#new\r\nuser_session POST   \/auth\/sign_in(.:format)        devise_token_auth\/sessions#create\r\ndestroy_user_session DELETE \/auth\/sign_out(.:format)       devise_token_auth\/sessions#destroy\r\nnew_user_password GET    \/auth\/password\/new(.:format)   devise_token_auth\/passwords#new\r\nedit_user_password GET    \/auth\/password\/edit(.:format)  devise_token_auth\/passwords#edit\r\nuser_password PATCH  \/auth\/password(.:format)       devise_token_auth\/passwords#update\r\nPUT    \/auth\/password(.:format)       devise_token_auth\/passwords#update\r\nPOST   \/auth\/password(.:format)       devise_token_auth\/passwords#create\r\ncancel_user_registration GET    \/auth\/cancel(.:format)         auth\/registrations#cancel\r\nnew_user_registration GET    \/auth\/sign_up(.:format)        auth\/registrations#new\r\nedit_user_registration GET    \/auth\/edit(.:format)           auth\/registrations#edit\r\nuser_registration PATCH  \/auth(.:format)                auth\/registrations#update\r\nPUT    \/auth(.:format)                auth\/registrations#update\r\nDELETE \/auth(.:format)                auth\/registrations#destroy\r\nPOST   \/auth(.:format)                auth\/registrations#create\r\nauth_validate_token GET    \/auth\/validate_token(.:format) devise_token_auth\/token_validations#validate_token<\/pre>\n<p>auth\/registrations \u306b\u3001\u300c#new\u300d\u3001\u300c#update\u300d\u306a\u3069\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u308b\u306e\u3092\u78ba\u8a8d\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u3067\u4e00\u65e6\u3001\u8a2d\u5b9a\u306f\u5b8c\u4e86\u3067\u3059\u3002\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\uff01<\/p>\n<h4>initialize<\/h4>\n<p>\u6bce\u56de\u3001\u6bce\u56de\u3001\u30c8\u30fc\u30af\u30f3\u304c\u5909\u66f4\u3055\u308c\u308b\u306e\u306f\u3061\u3087\u3063\u3068\u9762\u5012\u306a\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u69d8\u306b\u8a2d\u5b9a\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>config.change_headers_on_each_request \u3092 true \u306b\u3057\u3066\u3044\u308b\u3068\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3054\u3068\u306b token \u3092\u65b0\u3057\u304f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002 \u3068\u3044\u3046\u8a2d\u5b9a\u306b\u306a\u308b\u306e\u3067\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u89e3\u9664\u3057\u300cfalse\u300d\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\"># config.change_headers_on_each_request = true<\/pre>\n<p>\u2193<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">config.change_headers_on_each_request = false<\/pre>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\"># config.token_lifespan = 2.weeks<\/pre>\n<p>\u2193<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">config.token_lifespan = 1.month<\/pre>\n<p>\u305d\u306e\u4ed6\u3001config.headers_names\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u89e3\u9664\u3002<\/p>\n<p><strong>config\/initializers\/devise_token_auth.rb<\/strong><\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">DeviseTokenAuth.setup do |config|\r\n# By default the authorization headers will change after each request. The\r\n# client is responsible for keeping track of the changing tokens. Change\r\n# this to false to prevent the Authorization header from changing after\r\n# each request.\r\nconfig.change_headers_on_each_request = false\r\n\r\n# By default, users will need to re-authenticate after 2 weeks. This setting\r\n# determines how long tokens will remain valid after they are issued.\r\nconfig.token_lifespan = 1.month\r\n\r\n# Sets the max number of concurrent devices per user, which is 10 by default.\r\n# After this limit is reached, the oldest tokens will be removed.\r\n# config.max_number_of_devices = 10\r\n\r\n# Sometimes it's necessary to make several requests to the API at the same\r\n# time. In this case, each request in the batch will need to share the same\r\n# auth token. This setting determines how far apart the requests can be while\r\n# still using the same auth token.\r\n# config.batch_request_buffer_throttle = 5.seconds\r\n\r\n# This route will be the prefix for all oauth2 redirect callbacks. For\r\n# example, using the default '\/omniauth', the github oauth2 provider will\r\n# redirect successful authentications to '\/omniauth\/github\/callback'\r\n# config.omniauth_prefix = &quot;\/omniauth&quot;\r\n\r\n# By default sending current password is not needed for the password update.\r\n# Uncomment to enforce current_password param to be checked before all\r\n# attribute updates. Set it to :password if you want it to be checked only if\r\n# password is updated.\r\n# config.check_current_password_before_update = :attributes\r\n\r\n# By default we will use callbacks for single omniauth.\r\n# It depends on fields like email, provider and uid.\r\n# config.default_callbacks = true\r\n\r\n# Makes it possible to change the headers names\r\nconfig.headers_names = {:'access-token' =&gt; 'access-token',\r\n                        :'client' =&gt; 'client',\r\n                        :'expiry' =&gt; 'expiry',\r\n                        :'uid' =&gt; 'uid',\r\n                        :'token-type' =&gt; 'token-type' }\r\n\r\n# By default, only Bearer Token authentication is implemented out of the box.\r\n# If, however, you wish to integrate with legacy Devise authentication, you can\r\n# do so by enabling this flag. NOTE: This feature is highly experimental!\r\n# config.enable_standard_devise_support = false\r\nend<\/pre>\n<h4 class=\"e-f-w\">Restlet Client &#8211; REST API Testing<\/h4>\n<p>REST API\u3092\u30c6\u30b9\u30c8\u3059\u308b\u306e\u306b\u300c<strong>Restlet Client &#8211; REST API Testing<\/strong>\u300d\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u8a66\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>chrome\u306e\u62e1\u5f35\u6a5f\u80fd\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/chrome.google.com\/webstore\/detail\/restlet-client-rest-api-t\/aejoelaoggembcahagimdiliamlcdmfm\" target=\"_blank\" rel=\"noopener\"><strong>Restlet Client &#8211; REST API Testing<\/strong><\/a><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7878\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/d116b73111b8f6ab266c6d54f613c2a0.png\" alt=\"\" width=\"650\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/d116b73111b8f6ab266c6d54f613c2a0.png 1364w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/d116b73111b8f6ab266c6d54f613c2a0-300x262.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/d116b73111b8f6ab266c6d54f613c2a0-768x671.png 768w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/d116b73111b8f6ab266c6d54f613c2a0-1024x895.png 1024w\" sizes=\"(max-width: 1364px) 100vw, 1364px\" \/><\/p>\n<h4>API\u30c6\u30b9\u30c8<\/h4>\n<p>\u300c<strong>Restlet Client &#8211; REST API Testing<\/strong>\u300d\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3089\u65e9\u901f\u8a66\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>Rails s \u30b3\u30de\u30f3\u30c9\u3067Rails\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ rails s<\/pre>\n<h5>\u30e6\u30fc\u30b6\u30fc\u767b\u9332<\/h5>\n<p>\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306f\u300clocalhost:3000\/auth\u300d\u306epost\u3067\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>send\u30c7\u30fc\u30bf \u4f8b\uff1a<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"name\": \"daisuke.takayama\",\r\n  \"email\": \"webcyou@example.com\",\r\n  \"password\": \"password\",\r\n  \"team\": \"\u30a6\u30a7\u30d6\u5e33\"\r\n}<\/pre>\n<p><strong>\u30ec\u30b9\u30dd\u30f3\u30b9<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"status\": \"success\",\r\n  \"data\":{\r\n    \"id\": 1,\r\n    \"email\": \"webcyou@example.com\",\r\n    \"provider\": \"email\",\r\n    \"uid\": \"webcyou@example.com\",\r\n    \"name\": \"daisuke.takayama\",\r\n    \"nickname\": null,\r\n    \"image\": null,\r\n    \"team\": \"\u30a6\u30a7\u30d6\u5e33\",\r\n    \"created_at\": \"2017-05-20T07:41:15.000Z\",\r\n    \"updated_at\": \"2017-05-20T07:41:16.000Z\"\r\n  }\r\n}<\/pre>\n<p>\u6210\u529f\u3059\u308b\u3068\u3001\u4e0a\u8a18\u306e\u69d8\u306b\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u8fd4\u3063\u3066\u304f\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>DB\u306e\u65b9\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001users\u30c6\u30fc\u30d6\u30eb\u306b\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7879\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/bbeaa37cba9eb87dfff11bf3066ce008.png\" alt=\"\" width=\"500\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/bbeaa37cba9eb87dfff11bf3066ce008.png 928w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/bbeaa37cba9eb87dfff11bf3066ce008-300x85.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/bbeaa37cba9eb87dfff11bf3066ce008-768x218.png 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/p>\n<p>\u7d9a\u3044\u3066\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h5>\u30ed\u30b0\u30a4\u30f3<\/h5>\n<p>\u30ed\u30b0\u30a4\u30f3\u306f\u300clocalhost:3000\/auth\/sign_in\u300d\u306bPOST\u3067\u30ed\u30b0\u30a4\u30f3\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>send\u30c7\u30fc\u30bf \u4f8b\uff1a<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"email\": \"webcyou@example.com\",\r\n  \"password\": \"password\"\r\n}<\/pre>\n<p><strong>\u30ec\u30b9\u30dd\u30f3\u30b9<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"data\":{\r\n    \"id\": 1,\r\n    \"email\": \"webcyou@example.com\",\r\n    \"provider\": \"email\",\r\n    \"uid\": \"webcyou@example.com\",\r\n    \"name\": \"daisuke.takayama\",\r\n    \"nickname\": null,\r\n    \"image\": null,\r\n    \"team\": \"\u30a6\u30a7\u30d6\u5e33\"\r\n  }\r\n}<\/pre>\n<h5>\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5909\u66f4<\/h5>\n<p>\u7d9a\u3044\u3066\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5909\u66f4\u3002<\/p>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5909\u66f4\u306f\u3001 \u300clocalhost:3000\/auth\/password\u300d \u306b PUT \u30ea\u30af\u30a8\u30b9\u30c8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3044\u3088\u3044\u3088\u306a\u3093\u3067\u3059\u304c\u3001\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u3084\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5909\u66f4\u306a\u3069\u3092\u884c\u3046\u969b\u3001 \u8a8d\u8a3c\u60c5\u5831\u304c\u5fc5\u8981\u3068\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u70ba\u306b\u5fc5\u8981\u306a\u306e\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>REQUEST HEADERS\u306e<\/p>\n<p>\u30fb access-token<\/p>\n<p>\u30fb client<\/p>\n<p>\u30fb uid<\/p>\n<p>\u306e\u30013\u3064\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5148\u7a0b\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u969b\u306b\u3001HEADERS\u306b\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u308b\u60c5\u5831\u304c\u5fc5\u8981\u3068\u306a\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u5229\u7528\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7880\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/161f7bf4d73144863de0008d12ca146c.png\" alt=\"\" width=\"400\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/161f7bf4d73144863de0008d12ca146c.png 622w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/161f7bf4d73144863de0008d12ca146c-300x155.png 300w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><\/p>\n<p>\u300c<strong>Restlet Client &#8211; REST API Testing<\/strong>\u300d\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u69d8\u306b\u3001REQUEST\u306e\u90e8\u5206\u3067\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u30b3\u30d4\u30da\u3092\u884c\u3063\u3066\u5165\u529b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7881\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/0c7cc9099def25906c712779504db7a6.png\" alt=\"\" width=\"600\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/0c7cc9099def25906c712779504db7a6.png 748w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/05\/0c7cc9099def25906c712779504db7a6-300x171.png 300w\" sizes=\"(max-width: 748px) 100vw, 748px\" \/><\/p>\n<p>\u5165\u529b\u3057\u305f\u3089\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u5909\u66f4\u306e\u30c7\u30fc\u30bf\u3092 PUT\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>send\u30c7\u30fc\u30bf \u4f8b\uff1a<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"password\": \"password2\",\r\n  \"password_confirmation\": \"password2\"\r\n}<\/pre>\n<p><strong>\u30ec\u30b9\u30dd\u30f3\u30b9<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"success\": true,\r\n  \"data\":{\r\n    \"id\": 1,\r\n    \"provider\": \"email\",\r\n    \"email\": \"webcyou@example.com\",\r\n    \"uid\": \"webcyou@example.com\",\r\n    \"name\": \"daisuke.takayama\",\r\n    \"nickname\": null,\r\n    \"image\": null,\r\n    \"team\": \"\u30a6\u30a7\u30d6\u5e33\",\r\n    \"created_at\": \"2017-05-20T07:41:15.000Z\",\r\n    \"updated_at\": \"2017-05-20T08:11:19.000Z\"\r\n  },\r\n  \"message\": \"Your password has been successfully updated.\"\r\n}<\/pre>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u5909\u66f4\u304c\u51fa\u6765\u307e\u3057\u305f\u3002<\/p>\n<h5>\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u306e\u5909\u66f4<\/h5>\n<p>\u6700\u5f8c\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u306e\u5909\u66f4\u3092\u304a\u3053\u306a\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u306e\u5909\u66f4\u306f\u3001 \u300clocalhost:3000\/auth\/\u300d \u306b PUT \u30ea\u30af\u30a8\u30b9\u30c8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5148\u7a0b\u306e<\/p>\n<p>\u30fb access-token<\/p>\n<p>\u30fb client<\/p>\n<p>\u30fb uid<\/p>\n<p>\u306e\u60c5\u5831\u3092\u300cREQUEST HEADERS\u300d\u306b\u4ed8\u4e0e\u3057\u3001 \u300clocalhost:3000\/auth\/\u300d \u306b PUT \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u308a\u307e\u3059\u3002<\/p>\n<p><strong>send\u30c7\u30fc\u30bf \u4f8b\uff1a<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n  \"team\": \"webcyou\"\r\n}<\/pre>\n<p><strong>\u30ec\u30b9\u30dd\u30f3\u30b9<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">{\r\n\"status\": \"success\",\r\n  \"data\":{\r\n    \"id\": 1,\r\n    \"team\": \"webcyou\",\r\n    \"email\": \"webcyou@example.com\",\r\n    \"provider\": \"email\",\r\n    \"uid\": \"webcyou@example.com\",\r\n    \"name\": \"daisuke.takayama\",\r\n    \"nickname\": null,\r\n    \"image\": null,\r\n    \"created_at\": \"2017-05-20T07:41:15.000Z\",\r\n    \"updated_at\": \"2017-05-20T08:16:48.000Z\"\r\n  }\r\n}<\/pre>\n<p>\u6240\u5c5e\u3059\u308b\u300c\u30c1\u30fc\u30e0\u300d\u306e\u5909\u66f4\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30ec\u30b9\u30dd\u30f3\u30b9\u30c7\u30fc\u30bf\u3067\u5909\u66f4\u306b\u6210\u529f\u3057\u305f\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3001<br \/>\n\u4eca\u56de\u3001\u30b6\u30c3\u3068\u3067\u306f\u3042\u308a\u307e\u3057\u305f\u304c\u3001Token\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c\u3092\u5bb9\u6613\u306b\u5b9f\u88c5\u3067\u304d\u308b Gem \u300c<strong>devise token auth<\/strong>\u300d\u306e\u3054\u7d39\u4ecb\u3067\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30bd\u30fc\u30b9\u306b\u95a2\u3057\u3066\u306f\u3001github\u306e\u65b9\u306b\u3082\u8ffd\u52a0\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/webcyou\/devise_token_auth_demo\" target=\"_blank\" rel=\"noopener\">github &#8211; devise_token_auth_demo<\/a><\/p>\n<p>\u3053\u3061\u3089\u3092\u4f7f\u3063\u3066\u3001Token\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c\u306b\u5207\u308a\u66ff\u3048\u3001SPA\u30b5\u30a4\u30c8\u306a\u3069\u4f5c\u3063\u3066\u307f\u308b\u3068\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u3041\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002 \u3061\u3087\u3063\u3068Rails\u306e\u8a8d\u8a3c\u5468\u308a\u306b\u3064\u3044\u3066\u5c11\u3005\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3067\u8a8d\u8a3c\u304c\u5fc5\u8981\u306a\u5834\u5408\u3001\u5927\u304d\u304f2\u3064\u306e\u5b9f\u88c5\u65b9\u6cd5\u304c\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002 \u30fbCookie\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c \u30fbToken\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c \u4eca\u56de\u306f\u3001Token\u30d9\u30fc\u30b9\u306e\u8a8d\u8a3c\u306b\u3064 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[155],"tags":[166,37,47,173,45,95,178,78,114,118],"class_list":["post-7869","post","type-post","status-publish","format-standard","hentry","category-ruby","tag-iphone","tag-iphone-","tag-javascript-2","tag-php","tag-web","tag-95","tag-178","tag-78","tag-114","tag-118"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/7869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7869"}],"version-history":[{"count":15,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/7869\/revisions"}],"predecessor-version":[{"id":10183,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/7869\/revisions\/10183"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}