Token type is not allowed Error While using Client Id Client Secret

     When you are using Client Id and Client Secret first time you might get this below error

     {"error":"invalid_request","error_description":"Token type is not allowed."}  

    Reason
  • For 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
  • To  enable this feature, we need to connect to SharePoint using Windows PowerShell and then run set-spotenant -DisableCustomAppAuthentication $false

Open Windows power shell > Run below scripts
  • Install-Module -Name Microsoft.Online.SharePoint.PowerShell
  • $adminUPN="<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
Note: Update only <> section, run the remaining script as it is.

Suppose if you face any error while executing 5th line then, Enter only 
Connect-SPOService -Url https://$orgName-admin.sharepoint.com
& It will prompt window for credentials, enter username & Password. Now we will not get any error. Then execute the 6th script now.





Got this details from this link

 

Comments

Popular posts from this blog

Upload Single/Multiple file by using the REST API and jQuery SharePoint 2013

A type named 'SP.Data. could not be resolved by the model error

Add content type to SharePoint List/Library using REST API