Hello guys I am trying to sync the Outlook Calendar APi in my Laravel Project but I am getting this error ... I know it's something related to admin permission consent. How to request admin for api permission in azure portal? .....
Here is my Controller Code: When I uncomment the dd($graph) I do get the access token but when i comment the error shows which is in attached image. Anyone who experienced this while working with Outlook Calendar Api?
ERROR I AM GETTING:
Client error: GET https://graph.microsoft.com/v1.0/users/jahanzebchoudhry1@outlook.com/calendars resulted in a 401 Unauthorized response: {
"error": {
"code": "NoPermissionsInAccessToken",
"message": "The token contains no permissions, or permis (truncated...)
@jahanzeb786 Within Azure Portal, go to "App Registration" and create your app, if you haven't done so already. Once created, you can get your client id and the tenant id. You'll also need to add a client secret in which your app will use to authenticate.
With your app registered, you'll find a "API Permissions" button under the App Registration where you'll be able to request various access permissions for your app, including the Calendar. If you want your app to have access to all mailbox calendar accounts, you'll need the Microsoft Graph Calendars.Read Application rights. If you want to be able to modify, you'll need the Calendars.ReadWrite permission. You'll then need to get an administrator to grant the permission changes.
Once all the above has been set up, you should be able to perform your requests.
@talinon Thanks for the answer. I have already completed all the steps apart from this "You'll then need to get an administrator to grant the permission changes." Kindly tell me how can i get the admin which can grant the permission?
Navigate to: Azure Active Directory -> Roles and administrators
You can expand the roles to see who you need to contact to grant the permissions. You'll need either a Global, Application or Clould Application Administrator to grant the permission changes.
@talinon I have Navigated to Roles and administrators but IT says "No Access" and it has some other information like { "shellProps": { "sessionId": "cb33d184ae874e4dbbdfef8c4a4163b1", "extName": "Microsoft_AAD_IAM", "contentName": "AllRolesBlade", "code": 403 }, "error": { "message": "No access", "code": 403 }}
I want to contact you Kindly give me your email address or any other contact info so that I can show you the screenshots. SO It would be better to understand As there is no option to attach the image. Thank you!