P E N C I L
Login
How to set token manually

How to insert manually a token to tokenstore?

        InMemoryTokenStore storex = (InMemoryTokenStore) store.get();
        OAuth2AccessToken token= new DefaultOAuth2AccessToken("mytoken");
        OAuth2Request request = new OAuth2Request(new HashMap<>(), "clientId", new ArrayList<>(),
                true, new HashSet<>(), new HashSet<>(), "", new HashSet<>(), new HashMap<>());

        Authentication user = new BearerTokenAuthenticationToken("bearer token");
        user.setAuthenticated(true);
        OAuth2Authentication auth = new OAuth2Authentication(request, user);
        storex.storeAccessToken(token, auth);
        log.info("{}", storex);