jwt-auth错误小结
我用的是:"tymon/jwt-auth": "1.0.0-rc.1"
根据官方网站http://jwt-auth.readthedocs.io安装,并且vender:publish完配置文件后,需要按照官网的Update your User model章节配置一下auth所需要的一些类。我第一次用jwt-auth,没有进行按照Update your User model章节进行操作,并且所用的Eloquent也和官网不太一样,遇到了3个问题,在此总结一下:
1、config/auth.php
'guards' => [
'api' => [
'driver' => 'jwt',
'provider' => 'myexample',
],
],
结果在此文件下面的 'providers' 数组中忘记写 'myexample' 相关的 'driver' 和 'model' 了,导致了错误1:
"message": "Type error: Argument 2 passed to Tymon\\JWTAuth\\JWTGuard::__construct() must be an instance of Illuminate\\Contracts\\Auth\\UserProvider, null given, called in ...
问题2和3都是Eloquent Model中遇到的问题,没按照官网Update your User model章节所述导致的,解决办法就是像官网说的改改Auth用到的Model即可,主要是需要Model实现两个接口
2、Model没有实现JWTSubject接口报错:
"message": "Type error: Argument 1 passed to Tymon\\JWTAuth\\JWTGuard::login() must be an instance of Tymon\\JWTAuth\\Contracts\\JWTSubject, instance of App\\Entities\\Authors given, called in ...
3、Model没有实现AuthenticatableContract接口(契约)报错:
"message": "Type error: Argument 1 passed to Tymon\\JWTAuth\\JWTGuard::setUser() must be an instance of Illuminate\\Contracts\\Auth\\Authenticatable, instance of App\\Entities\\Authors given, called in ...
jwt-auth错误小结的更多相关文章
- 【翻译】REST framework JWT Auth(django rest framework-jwt)
JWT认证的REST框架 原文链接 概述 这个包提供对Django REST framework的JSON Web Token 认证支持. 需要满足条件 Python (2.7, 3.3, 3.4, ...
- <转>Python运行的17个时新手常见错误小结
1)忘记在 if , elif , else , for , while , class ,def 声明末尾添加 :(导致 “SyntaxError :invalid syntax”) 该错误将发生在 ...
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误小结
说法一: 我们在运行xcode工程时,有时候会遇到”libc++abi.dylib: terminate_handler unexpectedly threw an exception”错误,app莫 ...
- 微信支付errcode:40163,code been used,错误小结
1.配置时注意,支付平台中的支付授权目录, 注意大小写. 昨天碰到的问题,就是自己跳转时,路径写的全小写.跳转支付页面也能跳转过去,但是log中总是调用两次code,报40163错误.后改成和公总号支 ...
- Nodejs运行错误小结
(迁移自旧博客2017 04 15) 在使用过程中会遇到一些问题,学习过程中不定期更新. 问题一 错误如下 **events.js:72 throw er; // Unhandled 'error' ...
- GCC编译错误小结
gcc编译时对’xxxx’未定义的引用问题可能错误 错误一: 没有实现xxxx 错误二: c++引用c语言so库,但是so库头文件没有extern "C" 错误三: 检查各个共享库 ...
- (转)Springboot+shiro配置笔记+错误小结
springboot不像springmvc,它没有xml配置文件,那该如何配置shiro呢,其实也不难,用java代码+注解来解决这个问题.仅以此篇记录我对shiro的学习,如有对过客造成不便,实在抱 ...
- Springboot+shiro配置笔记+错误小结
软件152 尹以操 springboot不像springmvc,它没有xml配置文件,那该如何配置shiro呢,其实也不难,用java代码+注解来解决这个问题.仅以此篇记录我对shiro的学习,如有对 ...
- Python运行的17个时新手常见错误小结
1)忘记在if , elif , else , for , while , class ,def 声明末尾添加 :(导致“SyntaxError :invalid syntax”) 该错误将发生在类似 ...
随机推荐
- tesseract 中文二次训练
tesseract4.0以上版本可参考 https://github.com/tesseract-ocr/tesseract/wiki/TrainingTesseract-4.00#tutorial- ...
- plsql怎么执行sql脚本
首先,我们需要登录需要执行sql文件的用户,在我们确保sql文件无误的情况下,进入plsqldeveloper: 1,找到tools--->import tables --->选择sql ...
- ZooKeeper系列(8):ZooKeeper伸缩性
一.ZooKeeper中Observer 1.1 ZooKeeper角色 经过前面的介绍,我想大家都已经知道了在ZooKeeper集群当中有两种角色Leader和Follower.Leader可以接受 ...
- fastclick.js解决移动端(ipad)点击事件反应慢问题
参考http://blog.csdn.net/xjun0812/article/details/64919063 http://www.jianshu.com/p/16d3e4f9b2a9 问题的发现 ...
- javascript继承之学习笔记
今天记录一下学习javascript的继承. 继承基本上是基于“类”来说的,而javascript中并不存在真正的类,所以就出现了各种模拟“类”的行为,然后就堂而皇之的使用起了类的概念.这里不谈“类” ...
- 原生javascript AJAX 三级联动
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- redis集群尝试
1. 使用Docker搭建redis主从复制集群 安装参照 Docker 搭建redis 集群 启动服务 docker run --name redis-master -p 6379:6379 -d ...
- [Unity基础]RenderTexture
参考链接: https://www.cnblogs.com/Jimm/p/5951362.html 一.相关API 1.Texture2D.ReadPixels 从RenderTexture.acti ...
- 按键显示按键编码 keycode
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- python学习笔记_week5_模块
模块 一.定义: 模块:用来从逻辑上组织python代码(变量,函数,类,逻辑:实现一个功能), 本质就是.py结尾的python文件(文件名:test.py,对应模块名:test) 包:用来从逻辑上 ...