Learning Developer
value that you added to tenant ID may be incorrect or invalid. Have you double checked the tenant ID?
you can verify this value using azure or admin center
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We are creating a app where we can provide email services to user and user can schedule the email sending as well. For this we created a app on Microsoft Azure, Set up the permissions on App and added the users. I am writing JAVA POC for this using msal4j and microsoft graph api. This is what I am doing.
IAuthenticationProvider iAuthProvider = new TokenCredentialAuthProvider(clientSecretCredential());
GraphServiceClient<Request> graphClient = GraphServiceClient
.<Request>builder()
.authenticationProvider(iAuthProvider)
.buildClient();
//Creating msg body for Email
Message message = new Message();
graphClient.users(senderUserEmail).sendMail(UserSendMailParameterSet
.newBuilder()
.withMessage(message)
.withSaveToSentItems(saveToSentItems)
.build()).buildRequest()
.post();
I am using clientCredentialAuth for getting token I do have all the values ClientID, ClientSecret, TenantId. Method clientSecretCredential() is defined as below.
private ClientSecretCredential clientSecretCredential() {
return new ClientSecretCredentialBuilder()
.clientId(clientId)
.tenantId(tenantId)
.clientSecret(clientSecret)
.build();
}
but when I run the code I get following error.
{
"error": {
"code": "OrganizationFromTenantGuidNotFound",
"message": "The tenant for tenant guid {tenantId} does not exist.",
"innerError": {
"errorUrl": "https://aka.ms/autherrors#error-InvalidTenant",
"date": "2024-02-04T11:18:24"
}
}
}
Not sure what I am doing wrong here. I explored lot of solution but not getting solution of the error.
Learning Developer
value that you added to tenant ID may be incorrect or invalid. Have you double checked the tenant ID?
you can verify this value using azure or admin center