I’m developing a Resource Server using Spring Security OAuth2(http://projects.spring.io/spring-security-oauth/docs/oauth2.html) which interacts with Authorization Server to retrieve/validate Auth Tokens. The OAuth Flow used here is ‘client credentials’. The Application is working fine when Resource Server starts after Authorization Server, but in cases when resource server starts before Authorization Server, all client requests are getting ‘invalid token’ error with status code 401.
I could think of using an interceptor to intercept the request using ClientHttpRequestInterceptor and have a retry logic. But is there a correct approach to achieve proper resiliency or recovery mechanism for Resource Server when Auth Server is not available for a short period time.
Any pointers would be helpful.