I have this site here: http://msdn.microsoft.com/en-us/library/jj164022(v=office.15).aspx
the text in some part says: The following JavaScript code demonstrates how
There doesn't seem to be a way to get the access token only using JavaScript. You need to use an app to generate the access token. See the Sharepoint OAuth Tips and FAQs for more information about how to get the token.