STORMPATH:令牌无效,因为'at'时间(iat)晚于当前服务器时间

时间:2017-02-18 07:20:00

标签: spring-boot spring-security spring-security-oauth2 stormpath

我正在尝试将Spring Security(在Spring Boot之上)与StormPath集成。

一切正常,但是一旦用户成功登录后面会出现以下错误:

Sat Feb 18 12:43:27 IST 2017
There was an unexpected error (type=Internal Server Error, status=500).
com.stormpath.sdk.resource.ResourceException: HTTP 400, Stormpath 10012 (https://docs.stormpath.com/rest/product-guide/latest/errors.html#error-10012), RequestId 7e042da0-f5a9-11e6-afb8-22000be1c7ec: Token is invalid because the 'issued at' time (iat: 2017-02-18T07:13:27.000Z) is later than the current server time (2017-02-18T07:12:39.000Z).

Error Documentation

但是,在手动重定向到默认的身份验证成功URL(在我的情况下,它只是http://localhost:8080)时,它会成功显示注销按钮,而且也正常工作。

以下是目前的代码:

@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.apply(stormpath());
    }   
}

application.properties:

stormpath.client.apiKey.id = xxxx
stormpath.client.apiKey.secret = xxxxx

我还需要做些什么来克服这个错误?

1 个答案:

答案 0 :(得分:1)

看起来你提供的令牌有一个错误的时间戳,它声称将来会发行。

时差约为一分钟,因此当您手动尝试时,该分钟已经过去,这可能是手动重定向工作的原因。

我认为除了通知该服务的提供商调整服务器时间之外,您无能为力。