简体   繁体   English

Sharepoint 在线 - 不允许使用令牌类型

[英]Sharepoint online - Token type is not allowed

I'm trying to fetch all my projects and tasks from Microsoft project PWA using: https://.sharepoint.com/sites/pwa/_api/ProjectData/Projects.我正在尝试使用以下命令从 Microsoft 项目 PWA 中获取我的所有项目和任务:https://.sharepoint.com/sites/pwa/_api/ProjectData/Projects。 I managed to get my bearer token following some documentation and added it to the header of this route.我设法按照一些文档获取了我的不记名令牌,并将其添加到这条路线的 header 中。 But i'm receiving the following error: "error": "invalid_request", "error_description": "Token type is not allowed."但我收到以下错误:“error”:“invalid_request”,“error_description”:“Token type is not allowed。”

I faced the same issue and the following comment on another forum helped me.我遇到了同样的问题,另一个论坛上的以下评论对我有帮助。 The following is just a copy of what was messaged there.以下只是那里消息的副本。

For a new SharePoint subscription, Grant App Permission is disabled by default or the browser link https://xxxx-admin.sharepoint.com/_layouts/15/appinv.aspx is disabled.对于新的 SharePoint 订阅,默认禁用授予应用程序权限或浏览器链接https://xxxx-admin.sharepoint.com/_layouts.1已禁用。 To enable this feature, we need to connect to SharePoint using Windows PowerShell and then run set-spotenant -DisableCustomAppAuthentication $false.要启用此功能,我们需要使用 Windows PowerShell 连接到 SharePoint,然后运行 set-spotenant -DisableCustomAppAuthentication $false。

Run the following commands on PowerShell.在 PowerShell 上运行以下命令。

Install-Module -Name Microsoft.Online.SharePoint.PowerShell
$adminUPN="<the full email address of a SharePoint administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>"
$orgName="<name of your Office 365 organization, example: contosotoycompany>"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
set-spotenant -DisableCustomAppAuthentication $false

Please note:请注意:

Fill in the values for the $adminUPN and $orgName variables (replacing all the text between the quotes, including the < and > characters), and then run the following commands at the SharePoint Online Management Shell command prompt:填写 $adminUPN 和 $orgName 变量的值(替换引号之间的所有文本,包括 < 和 > 字符),然后在 SharePoint 在线管理 Shell 命令提示符处运行以下命令:

When prompted with the Windows PowerShell credential request dialog box, type the password for the SharePoint admin account.当提示 Windows PowerShell 凭据请求对话框时,键入 SharePoint 管理员帐户的密码。

Afterward, run https://xxxx-admin.sharepoint.com/_layouts/15/appinv.aspx to grant permission然后,运行https://xxxx-admin.sharepoint.com/_layouts/15/appinv.aspx授予权限

Generate new token and CRUD operations using REST API on SharePoint should be working by now.使用 REST API 在 SharePoint 上生成新的令牌和 CRUD 操作现在应该可以工作了。

Additional link: https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps附加链接: https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps

I think, there are multiple issues when using Powershell in the Mac environment to handle SharePoint.我认为,在 Mac 环境中使用 Powershell 处理 SharePoint 时存在多个问题。 You can try out m365 nodejs client as well.您也可以试用 m365 nodejs 客户端。 This was work fine for me in a Mac environment.这在 Mac 环境中对我来说很好用。 You can download it with the following command:您可以使用以下命令下载它:

 npm i -g @pnp/cli-microsoft365

The command would be as follows to disable custom app authentication:禁用自定义应用程序身份验证的命令如下:

 m365 spo tenant settings set --DisableCustomAppAuthentication false
Hope this would help. 希望这会有所帮助。

https://pnp.github.io/cli-microsoft365/cmd/spo/tenant/tenant-settings-set/ https://pnp.github.io/cli-microsoft365/cmd/spo/tenant/tenant-settings-set/

https://pnp.github.io/cli-microsoft365/ https://pnp.github.io/cli-microsoft365/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM