In my current application, I have created a refresh token / access token pair based on an authentication code I sent to my user. I continuously refresh this token (using said refresh token) to guarantee its integrity. When working directly with msal, I would get this token and pass it directly in the headers of my HTTP requests. I'm now migrating over to using the msgraph python sdk, and I cannot find a way of achieving this same flow using azure.identity in order to create a GraphServiceClient and make my requests.
I have at my disposal both the refresh and the access token, as well as the client id and secret.
Ok so I ended up doing something fairly naive, but it works. YMMV though. Also of important consideration, this application works on delegated permissions, so no
ClientSecretCredentialsfor me. I ended up creating something akin to:and using it like so:
All the credit goes to the answer here.