Access SharePoint Online via JSOM and Auth Bearer Token

%3CLINGO-SUB%20id%3D%22lingo-sub-69496%22%20slang%3D%22en-US%22%3EAccess%20SharePoint%20Online%20via%20JSOM%20and%20Auth%20Bearer%20Token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69496%22%20slang%3D%22en-US%22%3E%3CP%3EI%20know%20that%20I%20can%20access%20the%20Microsoft%20Graph%20with%20an%20Auth%20Bearer%20Token%20obtained%20from%20Azure%20AD.%20I%20know%20that%20I%20can%20access%20SharePoint%20Online%20with%20an%20Auth%20Bearer%20Token%20via%20CSOM%20as%20well.%20And%20I%20know%20that%20I%20can%20access%20SharePoint%20Online%20with%20an%20Auth%20Bearer%20Token%20via%20REST.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20can%20I%20also%20do%20that%20with%20JSOM%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20create%20in%20JSOM%20to%20create%20a%20SP.ClientContext%20object%20and%20set%20the%26nbsp%3BAuth%20Bearer%20Token%20like%20it's%20done%20in%20CSOM%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-69542%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20SharePoint%20Online%20via%20JSOM%20and%20Auth%20Bearer%20Token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69542%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20link.%20I%20will%20use%20this%20library%20when%20using%20REST.%20But%20it%20is%20not%20for%20JSON.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20the%20question%20still%20remains%3A%20Can%20we%20use%20JSON%20with%20Auth%20Bearer%20Token%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20ask%20this%20because%20Taxonomy%20Service%20is%20not%20available%20via%20REST%2C%20only%20via%20JSON.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-69506%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20SharePoint%20Online%20via%20JSOM%20and%20Auth%20Bearer%20Token%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69506%22%20slang%3D%22en-US%22%3E%3CP%3EHave%20a%20look%20at%20the%20following%20project%20in%20Github%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2FPnP-JS-Core%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2FPnP-JS-Core%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I know that I can access the Microsoft Graph with an Auth Bearer Token obtained from Azure AD. I know that I can access SharePoint Online with an Auth Bearer Token via CSOM as well. And I know that I can access SharePoint Online with an Auth Bearer Token via REST.

 

But can I also do that with JSOM? 

 

Is there a way to create in JSOM to create a SP.ClientContext object and set the Auth Bearer Token like it's done in CSOM?

 

Thanks!

2 Replies

Have a look at the following project in Github:

 

https://github.com/SharePoint/PnP-JS-Core

Thanks for the link. I will use this library when using REST. But it is not for JSON.

 

So the question still remains: Can we use JSON with Auth Bearer Token?

 

I ask this because Taxonomy Service is not available via REST, only via JSON.