public async Task <TokenTenant> GetGraphToken(string domain)
        {
            try
            {
                var tenantId = await GetTenantId(domain);

                var daemonClient = ConfidentialClientApplicationBuilder.CreateWithApplicationOptions(new ConfidentialClientApplicationOptions()
                {
                    ClientId = bottySettings.AppId, ClientSecret = bottySettings.AppSecrets, TenantId = tenantId, RedirectUri = bottySettings.Url
                }).Build();

                var authResult = await daemonClient.AcquireTokenForClient(new string[] { msGraphScope }).ExecuteAsync();

                var token = new TokenTenant()
                {
                    Token = authResult.AccessToken, ExpireDate = authResult.ExpiresOn.DateTime
                };

                return(token);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        private async Task <TokenTenant> GetGraphToken(string tenantId)
        {
            var token = new TokenTenant();

            try
            {
                var daemonClient = new ConfidentialClientApplication(Startup.clientId,
                                                                     String.Format(Constant.authorityFormat, tenantId), Startup.redirectUri,
                                                                     new ClientCredential(Startup.clientSecret), null, new TokenCache());
                var authResult = await daemonClient.AcquireTokenForClientAsync(new string[] { Constant.msGraphScope });

                token.Token = authResult.AccessToken;
            }
            catch (Exception ex)
            {
            }

            return(token);
        }