Hi @Dinesh Negi ,
I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.
By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:
[Call SharePoint Online rest api from console c# app with modern auth]
Issue Symptom:
- I am trying to call sharepoint search api from console app, in tenant only Modern authentication is active.
So i created Azure App and give there api permission ("AllSites.Read", "Sites.Search.All","Sites.Read.All", "Files.Read.All"). - I am able to get auth token , but getting unauthorized error during api call
Current status:
After nuget upgraded with Microsoft.identiy.model version verion v 4.4.1. Now able to fix this issue.
You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.