The route configured in laravel 5.3 route/api.php keeps prompting Unauthenticated. I added _token=xxxx but it doesn’t work either
The route configured in laravel 5.3 route/api.php keeps prompting Unauthenticated. I added _token=xxxx but it doesn’t work either
passport
<code class="bash">composer require laravel/passport</code>
For configuration, please refer to: API authorization document
PassportServiceProvider.php
Modify
PassportServiceProvider.php
<code class="php">//将这100year的过期时间!!!!!!!超过2038 $server->enableGrantType( new PersonalAccessGrant, new DateInterval('P100Y') ); //更改为1year $server->enableGrantType( new PersonalAccessGrant, new DateInterval('P1Y') );</code>
Reason:
<code>4字节也就是32位的存储空间的最大值是2147483647,当时间一秒一秒地跳完2147483647那惊心动魄的最后一秒后,它就会转为负数也就是说时间无效。那一刻的准确的时间为2038年1月18日星期一晚上10时14分7秒,之后所有用到这种“标准时间库”的C语言程序都会碰到时间计算上的麻烦。</code>
<code>这就是2038年问题。 </code>