Search code examples
spring-bootspring-securityspring-security-oauth2stormpath

STORMPATH : Token is invalid because the 'issued at' time (iat) is later than the current server time


I'm trying to integrate Spring Security(on top of Spring Boot) with StormPath.

Everything working fine, but as soon as user successfully login following error getting thrown:

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

But upon manually redirecting to the default auth success URL(in my case it's simply http://localhost:8080), it successflly showing logout button and that too is working.

Below is the code so far:

@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

What else I need to do to overcome this error?


Solution

  • Looks like the token you are supplying has a wrong time stamp, it claims to be issued in the future.

    The time difference is about a minute, so when you try it manually, that minute has passed, that may be the reason why the manual redirect works.

    I think there is not much you can do than inform the provider of that service to adjust their server times.