@@ -23,11 +23,11 @@ namespace Plumsail.DataSource.Dynamics365.BusinessCentral
2323{
2424 public class Authorize
2525 {
26- private AppSettings _settings ;
26+ private readonly AzureApp _settings ;
2727
2828 public Authorize ( IOptions < AppSettings > settings )
2929 {
30- _settings = settings . Value ;
30+ _settings = settings . Value . AzureApp ;
3131 }
3232
3333 [ FunctionName ( "Dynamics365-BusinessCentral-Authorize" ) ]
@@ -43,9 +43,9 @@ public async Task<IActionResult> Run(
4343 {
4444 var code = queryParams [ "code" ] ;
4545
46- var app = ConfidentialClientApplicationBuilder . Create ( _settings . AzureApp . ClientId )
47- . WithClientSecret ( _settings . AzureApp . ClientSecret )
48- . WithTenantId ( _settings . AzureApp . Tenant )
46+ var app = ConfidentialClientApplicationBuilder . Create ( _settings . ClientId )
47+ . WithClientSecret ( _settings . ClientSecret )
48+ . WithTenantId ( _settings . Tenant )
4949 . WithRedirectUri ( currentUrl )
5050 . Build ( ) ;
5151
@@ -57,8 +57,8 @@ public async Task<IActionResult> Run(
5757 }
5858
5959 var url = new StringBuilder ( ) ;
60- url . Append ( $ "https://login.microsoftonline.com/{ _settings . AzureApp . Tenant } /oauth2/v2.0/authorize?") ;
61- url . Append ( $ "client_id={ _settings . AzureApp . ClientId } &") ;
60+ url . Append ( $ "https://login.microsoftonline.com/{ _settings . Tenant } /oauth2/v2.0/authorize?") ;
61+ url . Append ( $ "client_id={ _settings . ClientId } &") ;
6262 url . Append ( $ "response_type=code&") ;
6363 url . Append ( $ "redirect_uri={ WebUtility . UrlEncode ( currentUrl ) } &") ;
6464 url . Append ( $ "response_mode=query&") ;
0 commit comments