-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should OnBehalfOfCredential refresh token automatically? #2551
Comments
Thanks for raising this @MichalLechowski I believe the real issue is in this line here as the error suggests that the Assertion pulled from the HttpContext is the expired one. To resolve this, you can probably
httpContext.HttpContext.Request.Headers.Authorization.ToString()["Bearer ".Length..], |
@andrueastman Thanks for suggestions, I downloaded the sample and connected to my graph to see if it'd work for running a long process (in that case I am creating MS Teams team with many channels and directories), but it doesn't seem to work. It works initially and I can see the resources created in MS Teams, but only as long as initial token is valid and then when it expires, I get the same error about assertion. The log:
the configuration is:
and GraphServiceClient is injected into GraphClient over DI Version of nugets:
|
I can't find any documentation for it, the question is if I use OBO flow and initialize graph client like below, should token be automatically refreshed? It does not seem to be or I am missing configuration somewhere. For a long running GraphAPI operation, if token expires, it ends up with: "Assertion is not within its valid time range". Should this work out of the box or if not how should this be implemented? Graph is instantiated only once for my custom graph service class.
OBO flow is used like that:
UI---request+token--->API A---request+token--->API B--->call GraphAPI with OBO token
What I tried?
Adding "offline_access" to scopes, does not seem to make a difference.
The text was updated successfully, but these errors were encountered: