Share via

Python SDK keeps asking to log in when making multiple API requests

Ruben van der Horst 0 Reputation points
2023-11-24T15:21:23.3633333+00:00

Hi all,

I'm currently working on an application that indexes a lot of pdf files. I want to recursively traverse my Onedrive, including shared folders. I use the Grpah API to do this, with all access granted.

This works like a charm, however, I keep being prompted to log in again after a few folders. I use the GraphServiceClient from the msgraph-sdk to create an acces token, which I use for making http requests with the Graph API. The requests are made with async functions. 

My script checks all driveItems in the root folder, checks the driveId and itemId of each driveItem and recursively goes trough all the folders, to list all pdf files. It is working fine, up until I need to log in again and again, to register my device. This happens when I am traversing my shared folders, but I don't get access issues: I think it has to do with the API connection.  

I don't think I exceed the API limits, but I do not have clue what the problem is. Does someone else have had that problem, or can someone point me into the right direction to fix this issue?

Thanks a lot,

Ruben

Microsoft Security | Microsoft Graph
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.