添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
We are using graph api to create appointment\event in exchange using below code which working fine with "microsoftonline.com" and "graph.microsoft.com" as below. our one client having domin "microsoftonline.us" and "graph.microsoft.us"

    Helper.Setting setting = Helper.ExchangeSetting.GetSetting(exchangeConfigName);  
            IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(setting.ClientIdGrpah)  
              .WithAuthority($"https://login.microsoftonline.com/{setting.TenantIdGraph}")  
              .WithRedirectUri(setting.PublicNotificationUrl)//("http://localhost")  
              .WithClientSecret(Helper.Cryptography.DecryptText(setting.ClientSecretGraph))  
              .Build();  
            string[] scopes = new string[] { "https://graph.microsoft.com/.default" };  
            AuthenticationResult authResult = await app.AcquireTokenForClient(scopes).ExecuteAsync().ConfigureAwait(false);  
            return authResult.AccessToken;    

To over come this cross domain issue we have change code to WithAuthority($"https://login.microsoftonline.us/{setting.TenantIdGraph}")
string[] scopes = new string[] { "https://graph.microsoft.us/.default" };
After code change we are getting token but when we try to create appointment\event we are getting below issue
Message: Access token validation failure. Invalid audience.
Inner error:
AdditionalData:
date: 2022-03-07T15:23:25
request-id: 53918c5f-6ba7-4869-984b-99e805d67aa1

Same permission has given on graph api (graph.microsoft.us)in azure which works for (graph.microsoft.com).

Need your experts help

Hi @neeraj badalu , if you're using the US Government L4 endpoint, please review this document and make sure everything is configured properly. As Carl mentioned, you need to make sure the SDK is referencing it and not another endpoint.

Best,
James