Home  >  Article  >  Backend Development  >  laravel 5.3 api routing keeps prompting Unauthenticated

laravel 5.3 api routing keeps prompting Unauthenticated

WBOY
WBOYOriginal
2016-12-01 01:27:422361browse

The route configured in laravel 5.3 route/api.php keeps prompting Unauthenticated. I added _token=xxxx but it doesn’t work either

Reply content:

The route configured in laravel 5.3 route/api.php keeps prompting Unauthenticated. I added _token=xxxx but it doesn’t work either

1. Check whether it is in accordance with passport

<code class="bash">composer require laravel/passport</code>

For configuration, please refer to: API authorization document

2. Modify 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>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Javascript and php issuesNext article:Javascript and php issues