Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No auth token found. Authentication Flow needed #1059

Open
akesh1235 opened this issue Mar 11, 2024 · 1 comment
Open

No auth token found. Authentication Flow needed #1059

akesh1235 opened this issue Mar 11, 2024 · 1 comment

Comments

@akesh1235
Copy link

RuntimeError when attempting to send email via O365

I'm trying to send an email using the O365 Python package, but I'm encountering a RuntimeError stating that no auth token is found, and an Authentication Flow is needed. I have already authenticated my app with the Azur App Directory and obtained the necessary credentials. Here's the code I'm running:

from O365 import Account

CLIENT_ID = "YOUR_CLIENT_ID"
CLIENT_SECRET = "YOUR_CLIENT_SECRET"
Subject =  'Testing!'
TO = "[email protected]"
Body = "George Best quote: I've stopped drinking, but only while I'm asleep."

credentials = (CLIENT_ID, CLIENT_SECRET)

account = Account(credentials)
m = account.new_message()
m.to.add(TO)
m.subject = Subject
m.body = Body
m.send()
@alejcas
Copy link
Member

alejcas commented Mar 11, 2024

call account.authenticate

Or if you already have the token credentials, load the token into the token backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants