title: How to get oauth2 access token in JavaScript
body: <p>When I have my own REST API (by own I mean it is hosted by the same app) how do i get an access token for a JavaScript app, that is running in the Frontend of the same application?</p>
  
  <p>If I would use the oauth2 client credential method, the frontend would have to have the users username and password (I don't want the users to have to type in their credentials again, as they are already authenticated via a cookie session)</p>
  
  <p>Can I render the users access token in the html output of the site, so that I can pick it up via JavaScript? Or is this insecure?</p>