"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
Occasional Visitor
Aim:- To access sharepoint through REST Api
 
Steps taken:- 
 
  1. Created site on sharepoint.
  2. Registered site as an app using https://<<domain>>/sites/<<site name>>/_layouts/15/appregnew.aspx
  3. Granted tenant scope permission using https://<<domain>>/sites/<<site name>>/_layouts/15/appinv.aspx
  4. Permission xml used
  5. <AppPermissionRequests AllowAppOnlyPolicy="true">
      <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
    </AppPermissionRequests>
          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."}
0 Replies