You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As someone very well stated here,
while the sample code for authentication from Android works perfectly fine, it is very unclear how to combine this with the Graph SDK, and especially the creation of the GraphServiceClient
How do we create a new instance of GraphServiceClient (Or how to get a AuhtenticationProvider like AzureIdentityAuthenticationProvider) from IAuthenticationResult or ISingleAccountPublicClientApplication or IAccount ?
The text was updated successfully, but these errors were encountered:
negoe
added
the
Enhancement
This is a feature request to add functionality that is not currently supported
label
Oct 30, 2024
Hi @diyoyo, Thanks a lot for feedback. I will consider your request and work with my team in near future to provide guidance for working MSAL in combination with Graph SDK. Thanks for your patience.
We use a BaseBearerTokenAuthenticationProvider to create a GraphServiceClient(authProvider, okHttpClient) object.
You have to substitute the "getToken()" call with your graph token - we keep ours in a cache and otherwise call aquireTokenSilent on the IMultipleAccountPublicClientApplication.
BaseBearerTokenAuthenticationProvider authProvider = new BaseBearerTokenAuthenticationProvider(new AccessTokenProvider() {
@NonNull
@Override
public String getAuthorizationToken(@NonNull URI uri, Map<String, Object> additionalAuthenticationContext) {
return getToken();
}
@NonNull
@Override
public AllowedHostsValidator getAllowedHostsValidator() {
//list of allowed hosts from AzureIdentityAccessTokenProvider
return new AllowedHostsValidator("graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com");
}
});
As someone very well stated here,
while the sample code for authentication from Android works perfectly fine, it is very unclear how to combine this with the Graph SDK, and especially the creation of the
GraphServiceClient
How do we create a new instance of
GraphServiceClient
(Or how to get aAuhtenticationProvider
likeAzureIdentityAuthenticationProvider
) fromIAuthenticationResult
orISingleAccountPublicClientApplication
orIAccount
?The text was updated successfully, but these errors were encountered: