-Born in Kanagawa Prefecture in 1990. ɾ Become an adult and start programming. -Joined Full Speed in 2015, and started freelance in 2017, and started business in Okinawa in November 2017. ◆ Hobby Play cosplay, live music, go to marathon, watch baseball ◆ Skill ɾ PHP, Symfony2, CakePHP3, Laravel5, ɾ JavaScript, backbone.js, Angular4, Vue.js, Nuxt.js I like piccolo cosplay
JSON Web Token, which is an authentication method using a digital signature URL-safe JSON. The biggest advantage is that it has a digital signature, so it can not be tampered with.
authentication information (login ID and password). 2) The server acquires authentication information, encrypts JSON including user_id and exp (expiration date) with a secret key, and returns it as JWT. 3 The client treats the received JWT as an authentication request and accesses resources.
Some reasons to recommend the use of JSON web tokens are: ɾ Can be used as URL parameter or header ɾ Horizontal scale is easy ɾ Easy debugging and management ɾ There is little burden on traffic ɾ Can create original REST service ɾ With built-in expiration date function ɾ The JWT is independent https://camp.isaax.io/ja/tips-ja/jwt-json-web-token
Token is returned Component Action Mutations State Plugin /login Routing Middleware Dispatch Render Commit Mutate eyJ0eXAiOiJKV1QiLCJhbGci OiJIUzI1NiJ9.eyJpc3MiOiJod HRwOlwvXC9sb2NhbGhvc3 RcL2FwaVwvdjFcL2xvZ2luIiw iaWF0IjoxNTQxMzk3NDAyLC JleHAiOjE1NDE0MDEwMDIs Im5iZiI6MTU0MTM5NzQwMi wianRpIjoiSGx1eUVXRU5Jc TdWRHZ6ZyIsInN1YiI6MSwi cHJ2IjoiMWFiMTVlMTVhNG NiODBjOWY3MTJkZTQ3OD ViMmIyMDk4ZGFlMjhjMyJ9. Qkbo7Mf4kMlTbWT- r4L6GhSUUlTUE7p7OHPdob FEXiI Token example HTML CSS JS Receive Token and set to localStorage Every time, check if Token is in localStrage. If not, redirect to login screen Each time, check localStorage and set token in Authorization header localStrage token get token On the server side Execute login process Issue a token. Access from browser, Enter user ID and password set token
is a mechanism to manage authentication, by default there are web and api. Web manages login from html. On the other hand, api is, as the name suggests, a Web API login. Since we use jwt-auth, we change api to jwt. edit config / auth.php
and password specify when the above user was registered. Then use the token to access the url you need to authenticate. Send Bearer: <token> in Authorization header. Data is returned.