• <tfoot id='Dgy7K'></tfoot>

      1. <i id='Dgy7K'><tr id='Dgy7K'><dt id='Dgy7K'><q id='Dgy7K'><span id='Dgy7K'><b id='Dgy7K'><form id='Dgy7K'><ins id='Dgy7K'></ins><ul id='Dgy7K'></ul><sub id='Dgy7K'></sub></form><legend id='Dgy7K'></legend><bdo id='Dgy7K'><pre id='Dgy7K'><center id='Dgy7K'></center></pre></bdo></b><th id='Dgy7K'></th></span></q></dt></tr></i><div id='Dgy7K'><tfoot id='Dgy7K'></tfoot><dl id='Dgy7K'><fieldset id='Dgy7K'></fieldset></dl></div>

        <small id='Dgy7K'></small><noframes id='Dgy7K'>

        <legend id='Dgy7K'><style id='Dgy7K'><dir id='Dgy7K'><q id='Dgy7K'></q></dir></style></legend>
        • <bdo id='Dgy7K'></bdo><ul id='Dgy7K'></ul>

        如何使 JWT 令牌 PHP 无效

        How to invalidate a JWT token PHP(如何使 JWT 令牌 PHP 无效)
        <tfoot id='1crwc'></tfoot>
        <legend id='1crwc'><style id='1crwc'><dir id='1crwc'><q id='1crwc'></q></dir></style></legend>

              <tbody id='1crwc'></tbody>

              <small id='1crwc'></small><noframes id='1crwc'>

              <i id='1crwc'><tr id='1crwc'><dt id='1crwc'><q id='1crwc'><span id='1crwc'><b id='1crwc'><form id='1crwc'><ins id='1crwc'></ins><ul id='1crwc'></ul><sub id='1crwc'></sub></form><legend id='1crwc'></legend><bdo id='1crwc'><pre id='1crwc'><center id='1crwc'></center></pre></bdo></b><th id='1crwc'></th></span></q></dt></tr></i><div id='1crwc'><tfoot id='1crwc'></tfoot><dl id='1crwc'><fieldset id='1crwc'></fieldset></dl></div>
                <bdo id='1crwc'></bdo><ul id='1crwc'></ul>
                • 本文介绍了如何使 JWT 令牌 PHP 无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使 JWT 中的令牌无效(或删除),但我无法实现.首先我做了类似这个答案的事情说 Laravel JWT-auth 身份验证的注销问题:

                  I'm trying to invalidate (or remove) a token from JWT but I can't achieve that. First I did something like this answer says Logout issue with Laravel JWT-auth authentication:

                  JWTAuth::invalidate(JWTAuth::getToken())):
                  

                  但我收到此错误:

                  不应静态调用非静态方法 TymonJWTAuthJWT::invalidate(),假设 $this 来自不兼容的上下文

                  Non-static method TymonJWTAuthJWT::invalidate() should not be called statically, assuming $this from incompatible context

                  然后我做了这样的事情:

                  Then I did something like this:

                  use IlluminateHttpRequest;
                  use TymonJWTAuthJWTAuth;
                  
                  class AuthController extends Controller
                  {
                      protected $jwt;
                  
                      public function __construct(JWTAuth $jwt)
                      {
                          $this->jwt = $jwt;
                      }
                  
                      public function invalidateToken(Request $request)
                      {
                          $this->jwt->parseToken()->invalidate();
                  
                          return response()->json(array('message' => 'log out'));
                      }
                  
                      ...
                  }
                  

                  但我仍然可以将令牌用于另一个请求,并且无法删除或使其无效.

                  But I can still use the token for another request and I can't remove or invalidate it.

                  我做错了什么使令牌无效?

                  What am I doing wrong to invalidate the token?

                  我从这里阅读了另一个问题,并在 github 上的 JWT 回购中发布了帖子(这是图书馆我正在使用),我按照所有示例使令牌无效或删除,但我仍然无法删除或使其无效.

                  I read another questions from here and issues post from the repo of JWT on github (this is the library I'm using) and I followed all the examples to invalidate or remove the token and I can't still remove or invalidate it .

                  推荐答案

                  如果您的 .env 文件中的 cache_driver 设置为数组以外的内容,则黑名单功能有效.

                  The blacklist feature works if cache_driver in your .env file is set to something other than array.

                  将其更改为文件对我有用.但是,在我的特殊情况下,我也使用了 Entrust,当 cache_driver 设置为文件或数据库时会导致问题.所以,不得不放弃黑名单/无效功能.

                  Changing it to file worked for me. However, in my particular case, I was using Entrust too, which causes issues when cache_driver is set to file or database. So, had to drop the blacklist/invalidate functionality.

                  希望这对某人有所帮助.

                  Hope this helps someone.

                  这篇关于如何使 JWT 令牌 PHP 无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='hPtJp'></tfoot>

                        <tbody id='hPtJp'></tbody>

                      <small id='hPtJp'></small><noframes id='hPtJp'>

                        • <bdo id='hPtJp'></bdo><ul id='hPtJp'></ul>
                          1. <legend id='hPtJp'><style id='hPtJp'><dir id='hPtJp'><q id='hPtJp'></q></dir></style></legend>
                            <i id='hPtJp'><tr id='hPtJp'><dt id='hPtJp'><q id='hPtJp'><span id='hPtJp'><b id='hPtJp'><form id='hPtJp'><ins id='hPtJp'></ins><ul id='hPtJp'></ul><sub id='hPtJp'></sub></form><legend id='hPtJp'></legend><bdo id='hPtJp'><pre id='hPtJp'><center id='hPtJp'></center></pre></bdo></b><th id='hPtJp'></th></span></q></dt></tr></i><div id='hPtJp'><tfoot id='hPtJp'></tfoot><dl id='hPtJp'><fieldset id='hPtJp'></fieldset></dl></div>