I'm trying to get access to my outlook calandar using the following code:
from bs4 import BeautifulSoup
from googleapiclient.discovery import build
from google.auth.transport.requests import Request
from O365 import Account
from O365 import Connection
from O365 import FileSystemTokenBackend
from configparser import ConfigParser
file='config.py'
config = ConfigParser()
config.read(file)
def authenticate_outlook():
# authenticate microsoft graph api credentials
credentials = (config['account']['outlook_client_id'], config['account']['outlook_client_id'])
token_backend = FileSystemTokenBackend(
token_path=config['account']['outlook_token_path'], token_filename=config['account']['outlook_token_filename']
)
account = Account(credentials, token_backend=token_backend)
if not account.is_authenticated:
# not authenticated, throw error
account.authenticate(scopes=config['account']['outlook_scopes'])
connection = Connection(credentials, token_backend=token_backend, scopes=config['account']['outlook_scopes'])
connection.refresh_token()
print("Authenticated Outlook.")
return account
# authenticate outlook credentials
outlook_acct = authenticate_outlook()
And i'm using this config.py file:
[account]
outlook_client_id = "86ae4814-fad2-4cc0-b76e-57bd4b20476c"
outlook_client_secret = "06ecc895-b04d-4578-9c3c-b5a8ccc026ab"
outlook_scopes = ["basic", "calendar"]
outlook_token_path = "./credentials/"
outlook_token_filename = "outlook_token.txt"
previous_days = 40 # retrieve this many past days of events
future_days = 365 # retrieve this many future days of events
Then I get this error: AADSTS700016: Application with identifier '"86ae4814-fad2-4cc0-b76e-57bd4b20476c"' was not found in the directory 'z7fs3'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.
I checked that i'm using the good app ID and the secret ID, They match with my app on AZURE, I don't ound the issue yet.
Thank you.
