Replies: 2 comments
-
🤖 Hello, Thank you for reaching out and for your detailed explanation of your issue. Your question is not basic at all, and it's great to see you're making progress with your application. To handle multiple user authentication requests in your Python app using the Office365 Toolkit, you can indeed modify the To handle multiple users, you need to store the tokens in separate files for each user. You can achieve this by modifying the Here's how you can modify the def _auth(self, user_id: str) -> Account:
"""Authenticates the OneDrive API client
Args:
user_id: The unique identifier for the user.
Returns:
The authenticated Account object.
"""
try:
from O365 import Account, FileSystemTokenBackend
except ImportError:
raise ImportError(
"O365 package not found, please install it with `pip install o365`"
)
token_backend = FileSystemTokenBackend(
token_path=Path.home() / ".credentials" / user_id
)
account = Account(
credentials=(
self.settings.client_id,
self.settings.client_secret.get_secret_value(),
),
scopes=self._scopes,
token_backend=token_backend,
**{"raise_http_errors": False},
)
# make the auth
account.authenticate()
return account In this modified Please note that this modification is not directly supported by the LangChain framework, and you will need to make this modification in your own code. Also, please ensure that you handle the user IDs and token files securely to prevent unauthorized access. I hope this helps! If you have any other questions, feel free to ask. Best, SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
@ironjunk Hi, I want to try O365 Tool in langchain too, could you please tell me how to apply Application (Client) ID and Client Secret ? grateful |
Beta Was this translation helpful? Give feedback.
-
Objective: I am trying to develop a small python app (Streamlit) which utilizes the Office365 Toolkit to schedule events on the outlook calendar for logged in outlook users using prompts.
What I have implemented so far:
my-app
⇾ set up necessary API permissions ⇾ save theApplication (Client) ID
andClient Secret
.my-app
by following the auth flow and giving consent using my outlook user[email protected]
.o365_token.txt
is generated in the project root folder.What I am struggling with: As next step in development, I wish to now enable my app to handle multiple user auth requests i.e. trigger the auth flow for a different user
[email protected]
while maintaining my original user[email protected]
's session.My Question: Is this something I can achieve with the O365 Toolkit directly? If not, is there some other way of implementing this requirement that you could suggest?
P.S.: I am new to using Langchain and O365 Toolkit. Apologies if this query comes off as basic or if this is something that is already discussed or solved.
Beta Was this translation helpful? Give feedback.
All reactions