Skip to content

Id token and access token do not get the updated user info when doing AcquireTokenSilentAsync #75

@nataliahering

Description

@nataliahering

I am doing the following steps

  1. Execute this code
var authResult1 = await app.AcquireTokenInteractive(App.ApiScopesBasic)
                   .WithUseEmbeddedWebView(false)
                    .WithParentActivityOrWindow(new WindowInteropHelper(this).Handle)
                    .ExecuteAsync();

which is in the SignInButton_Click code of this sample.
an id token is returned, which includes several claims including for example the user's first name - which right now is "name1".

  1. After the above call is done, I manually update the information of the user in the azure portal (eg. update the first name from "name1" to be "name2"). In reality, I would not update the user's info in the portal but I could have some other application updating the user's information using graph API while the user still has a valid refresh token.

  2. Do this call

var authResult2 = await app.AcquireTokenSilent(App.ApiScopesBasic, accounts.FirstOrDefault())
                        .WithForceRefresh(true)
                        .ExecuteAsync();

in the id token of this auth result, I still get the "name1" as in the call of step 1 (instead of the "name2" as updated in step 2). If instead of acquiring the token silently, I do an interactive one then I will get the correct name.

Is the .WithForceRefresh(true) not enough? How can I force get the user's latest information without requiring user interaction?

thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions