RogerSelwyn / MS365-Calendar

Microsoft 365 Calendar Integration for Home Assistant
MIT License
13 stars 1 forks source link

minimum_permissions #10

Closed Jakke17 closed 3 months ago

Jakke17 commented 4 months ago

Hey,

I have an O365 payed family account. I've set permissions on the Azure page and followed your instructions.

After I add the returned URL, it shows the error minimum permissions? see screenshot

thanks for the help

Scherm­afbeelding 2024-07-18 om 14 11 44
RogerSelwyn commented 4 months ago

To access a shared mailbox calendar by configuring shared_mailbox you need to provide that permission. Have you done so?

Jakke17 commented 4 months ago

Roger,

thank you for the quick response. Where can I set that permission? Azure portal? O365 admin portal. These are my permissions.

image

Greetz Jan

RogerSelwyn commented 4 months ago

Might be a bug, I’ll check

RogerSelwyn commented 4 months ago

Might be worth trying delete the token, so it reauthenticates from scratch

Jakke17 commented 4 months ago

I will give that a go. Here are my logs

This error originated from a custom integration.

Logger: custom_components.ms365_calendar.classes.permissions Source: custom_components/ms365_calendar/classes/permissions.py:59 integration: Micosoft 365 - Calendar (documentation, issues) First occurred: 14:06:17 (1 occurrences) Last logged: 14:06:17

Minimum required permissions: 'Calendars.Read.Shared'. Not available in token 'ms365_calendar_JanDebocCAL.token' for account 'JanDebocCAL'.

RogerSelwyn commented 4 months ago

You can look in the token and see if the permission is listed there. If it isn’t, then you need to reauthenticate.

Jakke17 commented 4 months ago

Still the same error. Delete the token with file editor

Jakke17 commented 4 months ago

this is my token.

{ "token_type": "Bearer", "scope": [ "User.Read" ], "expires_in": 3600, "ext_expires_in": 3600, "access_token": "{redacted}", "expires_at": 1721309410.6397078 }

RogerSelwyn commented 4 months ago

You are doing something wrong then since it should list all the permissions you have granted on Azure. I will go and look in a few minutes anyway.

Jakke17 commented 4 months ago

Ok Roger,

I will do a clean install of the API registration and the integration and will give you feedback

RogerSelwyn commented 4 months ago

Make sure the account you are creating the azure app with is the same one you are logging in with for authentication. To be honest you don't actually need to set up permissions on Azure, it will request them when you authenticate.

RogerSelwyn commented 4 months ago

I’ve added diagnostics support in v0.1.0, assuming you have diagnostics turned on on your HA instance you can download a file showing your configuration. It lists the requested (required) permissions and the granted permissions (from your token file). All requested permissions must appear in the granted permissions list.

Jakke17 commented 4 months ago

My HA installation is a clean one. So deleted the token file. Deleted the integration. Created a new app registration in Azure. Reinstalled integration. Still the same error.

I've added my diagnostic file. I don't know what else to do.

config_entry-hacs-01J2V25E5ETH89QBGS4G3K50ZF (3).json

RogerSelwyn commented 4 months ago

That is the diagnostic for HACS, not the calendar. But it may not be able to do the diagnostic until you get it installed properly.

If your token file doesn’t have the permissions in it, then it is likely the account you are authenticating with isn’t the one that you created the app with.

RogerSelwyn commented 4 months ago

Back from a walk. I would logout of MS world before doing the authentication, to ensure you are using the right credentials.

If you really can't figure and need a screen share, let me know.

Jakke17 commented 4 months ago

Hello Roger,

this weekend I tested with a completely new O365 account. Still the same error. Googled and used chatgpt to serach for an solution.

maybe we can do an screen share.

RogerSelwyn commented 3 months ago

Problem resolved via a screen share