How can I get an oauth access token in sharepoint 2013?

后端 未结 3 591
感动是毒
感动是毒 2020-12-09 08:47

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

相关标签:
3条回答
  • 2020-12-09 08:49

    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.

    0 讨论(0)
  • 2020-12-09 08:57

    Your entire approach is incorrect. When it comes to accessing the REST services of a sharepoint 2013 server using javascript you don't need an Access Token. You have to use the Sharepoint 2013 cross-domain library instead.

    The page at http://msdn.microsoft.com/en-us/library/jj164022.aspx explains after showing a classic REST request using an oauth token:

    This request would look a little different if you are writing your app in JavaScript but using the SharePoint 2013 cross-domain library. In this case, you don’t need to provide an access token. The following code demonstrates how this request would look if you are using the cross-domain library and want to receive the OData representation of the lists as XML instead of JSON. See How to: Access SharePoint 2013 data from remote apps using the cross-domain library for more information about using the cross-domain library.

    This is currently the url to that article http://msdn.microsoft.com/en-us/library/fp179927.aspx

    This should be your correct answer

    0 讨论(0)
  • 2020-12-09 09:02
    • This answers the question for sharepoint online.
    • It should be similar for any SharePoint list with OAuth2
      This talks about Postman or Fiddler, but we can modify this for JavaScript / JQuery
    0 讨论(0)
提交回复
热议问题