{"image_url":null,"published":"2021-10-10 11:36:16","title":"\u3010Rails+Vue\u3011jwt\u306b\u3088\u308b\u30c8\u30fc\u30af\u30f3\u8a8d\u8a3c","height":"190","author_name":"phytoyasu","provider_name":"Hatena Blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fphytoyasu.hatenablog.com%2Fentry%2F2021%2F10%2F10%2F113616\" title=\"\u3010Rails+Vue\u3011jwt\u306b\u3088\u308b\u30c8\u30fc\u30af\u30f3\u8a8d\u8a3c - phytoyasu\u306e\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://phytoyasu.hatenablog.com/entry/2021/10/10/113616","type":"rich","description":"\u8a8d\u8a3c\u306b\u304a\u3051\u308bjwt\u306e\u30e1\u30ea\u30c3\u30c8 CORS\u306a\u3069\u306e\u5236\u7d04\u304c\u306a\u3044 \u7570\u306a\u308b\u30c9\u30e1\u30a4\u30f3\u9593\u306e\u901a\u4fe1\u3092\u62d2\u5426\u3059\u308b\u5236\u7d04\u306b\u304b\u304b\u3089\u306a\u3044 \u30b9\u30b1\u30fc\u30e9\u30d6\u30eb\u3067\u3042\u308b cookie\u8a8d\u8a3c\u306e\u5834\u5408\u306f\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u4fdd\u6301\u3059\u308b\u5225\u306e\u30b5\u30fc\u30d0\u30fc\u3084DB\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002jwt\u8a8d\u8a3c\u306e\u5834\u5408\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306e\u307f\u3067\u8a8d\u8a3c\u304c\u3067\u304d\u308b\u305f\u3081\u30b9\u30b1\u30fc\u30e9\u30d6\u30eb\u3067\u3042\u308b\u3002 jwt(json web token) gem 'jwt'\u3067\u5b9f\u88c5\u3059\u308b\u3002 gem 'jwt' require 'jwt' # \u30a8\u30f3\u30b3\u30fc\u30c9 payload = { data: 'test' } token = JWT.encode payload, key puts token # eyJhbGciOiJub25l\u2026","author_url":"https://blog.hatena.ne.jp/phytoyasu/","categories":["Ruby/Rails","Vue.js"],"width":"100%","blog_url":"https://phytoyasu.hatenablog.com/","blog_title":"phytoyasu\u306e\u30d6\u30ed\u30b0","version":"1.0","provider_url":"https://hatena.blog"}