Azure/AzureAuth

Failed to obtain Azure Active Directory token

adrian98dybowski opened this issue · 0 comments

Hello,

I have weird problem with my token authentication in One Drive. I created R script which connects with list of xlsx in one shared folder in One Drive. This script is used in R shiny app and as CRON to daily updating data from xlsx to SQL database. I am using token authentication:

one_drive_connection <- get_business_onedrive()
folder <- one_drive_connection$list_shared_items() %>%
filter(name == '{FOLDER_NAME}') %>%
pull(remoteItem) %>%
.[[1]]

Script and token authorization is now working when:

  • I activate script locally;
  • I activate script in application on production server;
  • cron for this script is working on my user account.

It also worked to August 5th as cron in Dockerfile on another user account. But suddenly it stopped working and I am not sure why. The error is:

Loading Microsoft Graph login for default tenant
Access token has expired or is no longer valid; refreshing
Error in process_aad_response(res) :
Bad Request (HTTP 400). Failed to obtain Azure Active Directory token. Message:
AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2023-05-08T12:00:02.9934064Z and was inactive for 90.00:00:00.
Trace ID: d3e47bfc-9a5c-4754-8e99-c6e4bc033a00
Correlation ID: 7b2c4130-f9af-4056-b3ae-4ed3b330feb5
Timestamp: 2023-08-10 01:15:06Z.
Error: Unable to refresh token
Execution halted

I know that in the message there is something about 'token expired' and 'inactivity', but the same token is working in another case (everywhere I used my token, the same). So I think that it's not due to token. Maybe is it due to using this cron in dockerfile? But I created new dockerfile and there is the same problem. Dockerfile was working from the beginning of June 2023.

Is there anybody who can help?