Our scenario is following:
User logs in through SSO (using Azure AD) to our website.
On the site we have a page that will show links to some documents from SharePoint.
The page will query SharePoint 2013 on prem through its REST API to get a list of those documents.
My problem is obtaining the Bearer token that I would use for my REST API calls. https://msdn.microsoft.com/en-us/library/office/dn292553.aspx#Files
I would very much appreciate a code example on how to obtain the Bearer token.