Hello,
I am trying to iterate through active directories to get list of users in each AD. My code base on: https://github.com/AzureADSamples/WebApp-WebAPI-MultiTenant-OpenIdConnect-DotNet
How I see it:
1. Admin1 from AD1 log on and I catch refresh token from access token (rt1).
2. Admin1 log off, admin2 from AD2 log on and I catch another refresh token (rt2).
3. Now, using AcquireTokenByRefreshToken I would like to connect to each AD and get some info.
Actual, after these 3 steps, when I am still logged on admin2, I can use refresh token from step2 and get what I want, but there is a problem with rt1. When trying to use AcquireTokenByRefreshToken with rt1 I got:
AADSTS70002: Error validating credentials. AADSTS70000: The provided access grant is invalid or malformed.
If I log on another admin of AD1, and get refresh token, I will be able to use new refresh token and rt1 from step1. I need to iterate through these AD without being logged on any of this account. What am I doing wrong?
Best regards,
MGo