<legend id='xo0C7'><style id='xo0C7'><dir id='xo0C7'><q id='xo0C7'></q></dir></style></legend>

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

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

          <bdo id='xo0C7'></bdo><ul id='xo0C7'></ul>

        PHP JWT 令牌无效签名

        PHP JWT Token Invalid Signature(PHP JWT 令牌无效签名)
          <i id='sR39o'><tr id='sR39o'><dt id='sR39o'><q id='sR39o'><span id='sR39o'><b id='sR39o'><form id='sR39o'><ins id='sR39o'></ins><ul id='sR39o'></ul><sub id='sR39o'></sub></form><legend id='sR39o'></legend><bdo id='sR39o'><pre id='sR39o'><center id='sR39o'></center></pre></bdo></b><th id='sR39o'></th></span></q></dt></tr></i><div id='sR39o'><tfoot id='sR39o'></tfoot><dl id='sR39o'><fieldset id='sR39o'></fieldset></dl></div>

                <tbody id='sR39o'></tbody>

                <tfoot id='sR39o'></tfoot>
              1. <small id='sR39o'></small><noframes id='sR39o'>

                <legend id='sR39o'><style id='sR39o'><dir id='sR39o'><q id='sR39o'></q></dir></style></legend>

                • <bdo id='sR39o'></bdo><ul id='sR39o'></ul>
                  本文介绍了PHP JWT 令牌无效签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我现在正在搜索一个小时,但找不到解决此问题的方法.

                  这是生成 JWT 令牌的代码.我使用了

                  谁能帮我解决这个问题?我目前是 JWT 的新手.顺便说一句,我的项目是 Slim API.

                  非常感谢.

                  解决方案

                  签名验证失败,因为您没有将正确的密钥传递给 https://jwt.io/ 您需要从 PHP 代码中传递 $secretKey 的值.根据屏幕截图,您正在传递字符串 secret.

                  I'm searching for an hours now and can't find a solution to this problem.

                  This is the code to generate JWT token. I used https://github.com/firebase/php-jwt library.

                          $tokenId    = base64_encode(mcrypt_create_iv(32));
                          $issuedAt   = time();
                          $notBefore  = $issuedAt + 10;             //Adding 10 seconds
                          $expire     = $notBefore + 60;            // Adding 60 seconds
                          $serverName = 'serverName'; // Retrieve the server name from config file
                  
                          $secretKey = base64_decode(getenv('JWT_SECRET'));
                  
                           $data = [
                              'iat'  => $issuedAt,         // Issued at: time when the token was generated
                              'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token
                              'iss'  => $serverName,       // Issuer
                              'nbf'  => $notBefore,        // Not before
                              'exp'  => $expire,           // Expire
                              'data' => [                  // Data related to the signer user
                                  'userId'   => '1', // userid from the users table
                                  'userName' => $UserName, // User name
                              ]
                          ];
                  
                          $jwt = JWT::encode(
                                  $data,      //Data to be encoded in the JWT
                                  $secretKey, // The signing key
                                  'HS256'     // Algorithm used to sign the token
                          );
                  
                          $unencodedArray = ['jwt' => $jwt];
                          echo json_encode($unencodedArray);
                  

                  And I verify the token at https://jwt.io/

                  Can anybody help me with this problem? I'm currently new in JWT. Btw, my project is Slim API.

                  Thank you very much.

                  解决方案

                  Signature verification fails because you are not passing the correct secret key to https://jwt.io/ You need to pass the value of $secretKey from the PHP code. According to the screenshot you are passing string secret.

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

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

                  相关文档推荐

                  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 的问题)

                        <small id='36GIK'></small><noframes id='36GIK'>

                        <legend id='36GIK'><style id='36GIK'><dir id='36GIK'><q id='36GIK'></q></dir></style></legend>
                          <bdo id='36GIK'></bdo><ul id='36GIK'></ul>
                            <tbody id='36GIK'></tbody>

                          • <tfoot id='36GIK'></tfoot>

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