title: Spring OAuth2 - Manually creating an access token in the token store
body: <p>I have a situation where I would like to create an access token myself (so not through the usual process). I have come up with something like this:</p>
  
  <pre><code>@Inject
  private DefaultTokenServices defaultTokenServices;
  
  ... 
  
  OAuth2Authentication auth = xxx;
  OAuth2AccessToken  token = defaultTokenServices.createAccessToken(auth);
  </code></pre>
  
  <p>The only problem is that I am not sure how to create the OAuth2Authentication (in my code the part with xxx). I have the user &amp; client info and I know which Authorities I want to grant this token. </p>