-
Notifications
You must be signed in to change notification settings - Fork 493
Description
Version
master/4.7.x
Describe the bug
If the OAuthScope is not passed into GetAppCredentialsAsync, the cacheKey for the AppCredentials is incorrect:
| var cacheKey = $"{appId}{oAuthScope}"; |
When the method creates an AppCredentials, these AppCredentials will instantiate with a default OAuthScope. So the cacheKey for "some-app-id" returns an AppCredentials that should actually be stored under "some-app-idhttps://api.botframework.com/".
This is further complicated by proactive messaging to non-channel recipients which means the audience may not be a default value (see microsoft/botframework-sdk#5751).
The Claims from a skill don't indicate the final recipient of the Skill-sent message.
CreateConnectorClientAsync calls should also take a string scope parameter as this method calls GetAppCredentialsAsync().
botbuilder-dotnet/libraries/Microsoft.Bot.Builder/BotFrameworkAdapter.cs
Lines 384 to 389 in 48c2d45
| using (var context = new TurnContext(this, activity)) | |
| { | |
| context.TurnState.Add<IIdentity>(BotIdentityKey, claimsIdentity); | |
| context.TurnState.Add<BotCallbackHandler>(callback); | |
| var connectorClient = await CreateConnectorClientAsync(activity.ServiceUrl, claimsIdentity, cancellationToken).ConfigureAwait(false); |
Expected behavior
Scope to be provided whenever GetAppCredentialsAsync is called, and correct cache keys.
Additional context
[bug]