Microsoft
Tech Community
Home
Community Hubs
Community Hubs
Community Hubs Home
Products
Special Topics
Video Hub
Close
Products
(68)
Special Topics
(41)
Video Hub
(857)
Most Active Hubs
Microsoft Teams
Microsoft Excel
Windows
Security, Compliance and Identity
Office 365
SharePoint
Windows Server
Azure
Exchange
Microsoft 365
Microsoft Edge Insider
.NET
Sharing best practices for building any app with .NET.
Microsoft FastTrack
Best practices and the latest news on Microsoft FastTrack
Microsoft Viva
The employee experience platform to help people thrive at work
Most Active Hubs
ITOps Talk
Core Infrastructure and Security
Microsoft Learn
Education Sector
Microsoft 365 PnP
AI and Machine Learning
Microsoft Mechanics
Healthcare and Life Sciences
Small and Medium Business
Public Sector
Internet of Things (IoT)
Azure Partner Community
Expand your Azure partner-to-partner network
Microsoft Tech Talks
Bringing IT Pros together through In-Person & Virtual events
MVP Award Program
Find out more about the Microsoft MVP Award Program.
Video Hub
Azure
Exchange
Microsoft 365
Microsoft 365 Business
Microsoft 365 Enterprise
Microsoft Edge
Microsoft Outlook
Microsoft Teams
Security
SharePoint
Windows
Blogs
Blogs
Events
Events
Events Home
Microsoft Ignite
Microsoft Build
Community Events
Microsoft Learn
Microsoft Learn
Home
Community
Blog
Azure
Dynamics 365
Microsoft 365
Security, Compliance & Identity
Power Platform
Github
Teams
.NET
Lounge
Lounge
840K
Members
7,609
Online
2.3M
Discussions
Search
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Show
only
|
Search instead for
Did you mean:
Sign In
Sign In
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Show
only
|
Search instead for
Did you mean:
Home
Home
Office 365
Office 365
"Token type is not allowed" error on sharepoint search API
"Token type is not allowed" error on sharepoint search API
%3CLINGO-SUB%20id%3D%22lingo-sub-3079693%22%20slang%3D%22en-US%22%3E%22Token%20type%20is%20not%20allowed%22%20error%20on%20sharepoint%20search%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3079693%22%20slang%3D%22en-US%22%3E%3CDIV%3E%3CSPAN%3EAim%3A-%20To%20access%20sharepoint%20through%20REST%20Api%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ESteps%20taken%3A-%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3COL%3E%3CLI%3E%3CSPAN%3ECreated%20site%20on%20sharepoint.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3ERegistered%20site%20as%20an%20app%20using%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CA%20title%3D%22Original%20URL%3A%20https%3A%2F%2Fbhyve10.sharepoint.com%2Fsites%2FTech%2F_layouts%2F15%2Fappregnew.aspx.%20Click%20or%20tap%20if%20you%20trust%20this%20link.%22%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fbhyve10.sharepoint.com%252Fsites%252FTech%252F_layouts%252F15%252Fappregnew.aspx%26amp%3Bdata%3D04%257C01%257Co365sup8%2540microsoft.com%257Cbfe06b253de34885950a08d9e23b8f0d%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637789568299728568%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DWY%252BGE1%252FpQurUMOeVsdfvW3F3mnWfIjcaCUOmNkWknSU%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20nofollow%22%3Ehttps%3A%2F%2F%26lt%3B%3CDOMAIN%3E%26gt%3B%2Fsites%2F%26lt%3B%3CSITE%20name%3D%22%22%3E%26gt%3B%2F_layouts%2F15%2Fappregnew.aspx%3C%2FSITE%3E%3C%2FDOMAIN%3E%3C%2FA%3E%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3EGranted%20tenant%20scope%20permission%20using%26nbsp%3B%3C%2FSPAN%3E%3CA%20title%3D%22Original%20URL%3A%20https%3A%2F%2Fbhyve10.sharepoint.com%2Fsites%2FTech%2F_layouts%2F15%2Fappregnew.aspx.%20Click%20or%20tap%20if%20you%20trust%20this%20link.%22%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fbhyve10.sharepoint.com%252Fsites%252FTech%252F_layouts%252F15%252Fappregnew.aspx%26amp%3Bdata%3D04%257C01%257Co365sup8%2540microsoft.com%257Cbfe06b253de34885950a08d9e23b8f0d%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637789568299728568%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DWY%252BGE1%252FpQurUMOeVsdfvW3F3mnWfIjcaCUOmNkWknSU%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20nofollow%22%3E%3CSPAN%3Ehttps%3A%2F%2F%26lt%3B%3CDOMAIN%3E%26gt%3B%2Fsites%2F%26lt%3B%3CSITE%20name%3D%22%22%3E%26gt%3B%2F_layouts%2F15%2Fappinv.aspx%3C%2FSITE%3E%3C%2FDOMAIN%3E%3C%2FSPAN%3E%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3EPermission%20xml%20used%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3E%3CAPPPERMISSIONREQUESTS%20allowapponlypolicy%3D%22%26quot%3Btrue%26quot%3B%22%3E%3C%2FAPPPERMISSIONREQUESTS%3E%3C%2FSPAN%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%3CAPPPERMISSIONREQUEST%20scope%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2Fsharepoint%2Fcontent%2Fsitecollection%2Fweb%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2Fsharepoint%2Fcontent%2Fsitecollection%2Fweb%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsharepoint%2Fcontent%2Fsitecollection%2Fweb%3C%2FA%3E%22%20Right%3D%22FullControl%22%20%2F%26gt%3B%3C%2FAPPPERMISSIONREQUEST%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B4.%20Collected%20app%20identifier%20from%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CA%20title%3D%22Original%20URL%3A%20https%3A%2F%2Fbhyve10.sharepoint.com%2Fsites%2FTech%2F_layouts%2F15%2Fappregnew.aspx.%20Click%20or%20tap%20if%20you%20trust%20this%20link.%22%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fbhyve10.sharepoint.com%252Fsites%252FTech%252F_layouts%252F15%252Fappregnew.aspx%26amp%3Bdata%3D04%257C01%257Co365sup8%2540microsoft.com%257Cbfe06b253de34885950a08d9e23b8f0d%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637789568299728568%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DWY%252BGE1%252FpQurUMOeVsdfvW3F3mnWfIjcaCUOmNkWknSU%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20nofollow%22%3E%3CSPAN%3Ehttps%3A%2F%2F%26lt%3B%3CDOMAIN%3E%26gt%3B%2Fsites%2F%26lt%3B%3CSITE%20name%3D%22%22%3E%26gt%3B%2F_layouts%2F15%2Fappprincipals.aspx%3C%2FSITE%3E%3C%2FDOMAIN%3E%3C%2FSPAN%3E%3C%2FA%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B5.%20Fetched%20access%20token%20using%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CA%20title%3D%22Original%20URL%3A%20https%3A%2F%2Faccounts.accesscontrol.windows.net%2F%253C%253C%253E%253E%2Ftokens%2FOAuth%2F2%2F.%20Click%20or%20tap%20if%20you%20trust%20this%20link.%22%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Faccounts.accesscontrol.windows.net%252F%25253C%25253C%25253E%25253E%252Ftokens%252FOAuth%252F2%252F%26amp%3Bdata%3D04%257C01%257Co365sup8%2540microsoft.com%257Cbfe06b253de34885950a08d9e23b8f0d%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637789568299728568%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DtCjKyunrE4H9LbphNC0sQYV7YS0yLn24muvgfEL6U%252BE%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20nofollow%22%3Ehttps%3A%2F%2Faccounts.accesscontrol.windows.net%2F%26lt%3B%3CTENANT%20id%3D%22%22%3E%26gt%3B%2Ftokens%2FOAuth%2F2%2F%3C%2FTENANT%3E%3C%2FA%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B6.%20Tried%20to%20search%20using%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CA%20title%3D%22Original%20URL%3A%20https%3A%2F%2Fbhyve10.sharepoint.com%2Fsites%2FTech%2F_api%2Fsearch%2Fquery%3Fquerytext%3D'smart'.%20Click%20or%20tap%20if%20you%20trust%20this%20link.%22%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fbhyve10.sharepoint.com%252Fsites%252FTech%252F_api%252Fsearch%252Fquery%253Fquerytext%253D%2527smart%2527%26amp%3Bdata%3D04%257C01%257Co365sup8%2540microsoft.com%257Cbfe06b253de34885950a08d9e23b8f0d%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637789568299728568%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DQ0bcbQ660duts0ylYkBfE5GlCBUYtpEQKFWD61V8QvE%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20nofollow%22%3Ehttps%3A%2F%2Fbhyve10.sharepoint.com%2Fsites%2FTech%2F_api%2Fsearch%2Fquery%3Fquerytext%3D'smart'%3C%2FA%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Headers%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3BContent-Type%3Aapplication%2Fjson%3Bodata%3Dverbose%3C%2FSPAN%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Accept%3Aapplication%2Fjson%3Bodata%3Dverbose%3C%2FSPAN%3E%3C%2FDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Authorization%3ABearer%20%26lt%3B%3CACCESS%20token%3D%22%22%20from%3D%22%22%20step%3D%22%22%205%3D%22%22%3E%26gt%3B%3C%2FACCESS%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BGot%20below%20error%26nbsp%3Bmessage%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%7B%22error%22%3A%22invalid_request%22%2C%22error_description%22%3A%22Token%20type%20is%20not%20allowed.%22%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3079693%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharepoint%20REST%20API%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Discussion Options
Subscribe to RSS Feed
Mark Discussion as New
Mark Discussion as Read
Pin this Discussion for Current User
Bookmark
Subscribe
Printer Friendly Page
Aniket_Nade
Occasional Visitor
Jan 28 2022
05:08 AM
Mark as New
Bookmark
Subscribe
Mute
Subscribe to RSS Feed
Permalink
Print
Email to a Friend
Report Inappropriate Content
Jan 28 2022
05:08 AM
"Token type is not allowed" error on sharepoint search API
Aim:- To access sharepoint through REST Api
Steps taken:-
Created site on sharepoint.
Registered site as an app using
https://<<domain>>/sites/<<site name>>/_layouts/15/appregnew.aspx
Granted tenant scope permission using
https://<<domain>>/sites/<<site name>>/_layouts/15/appinv.aspx
Permission xml used
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="
http://sharepoint/content/sitecollection/web
" Right="FullControl" />
</AppPermissionRequests>
4. Collected app identifier from
https://<<domain>>/sites/<<site name>>/_layouts/15/appprincipals.aspx
5. Fetched access token using
https://accounts.accesscontrol.windows.net/<<tenant id>>/tokens/OAuth/2/
6. Tried to search using
https://bhyve10.sharepoint.com/sites/Tech/_api/search/query?querytext='smart'
Headers
Content-Type:application/json;odata=verbose
Accept:application/json;odata=verbose
Authorization:Bearer <<access token from step 5>>
Got below error message
{"error":"invalid_request","error_description":"Token type is not allowed."}
Labels:
Labels:
Sharepoint REST API
All Discussions
Previous Discussion
Next Discussion
0 Replies
Browse