Exemple #1
0
        public async Task <IActionResult> OnGetAsync()
        {
            //Check if has auth tokens
            var authTokens = await _authConfigRepository.GetAuthConfigAsync(ApplicationCore.Entities.SageApplicationType.DAMA_BACKOFFICE);

            if (string.IsNullOrEmpty(authTokens.AccessToken))
            {
                return(Redirect(string.Format(_settings.AuthorizationURL, authTokens.ClientId, authTokens.CallbackURL)));
            }
            _accessToken  = authTokens.AccessToken;
            _refreshToken = authTokens.RefreshToken;
            return(Page());
        }
Exemple #2
0
 protected async Task <AuthConfig> GetAuthConfigAsync(SageApplicationType type)
 {
     return(await _cache.GetOrCreateAsync($"CONFIG_TYPE_{type}", async entry =>
     {
         entry.SlidingExpiration = TimeSpan.FromSeconds(30);
         return await _authRepository.GetAuthConfigAsync(type);
     }));
 }
        public async Task <IActionResult> OnGet()
        {
            //Check if has auth tokens
            var authTokens = await _authConfigRepository.GetAuthConfigAsync(SageApplicationType.SALESWEB);

            if (string.IsNullOrEmpty(authTokens.AccessToken))
            {
                return(Redirect(string.Format(_settings.Sage.AuthorizationURL, authTokens.ClientId, authTokens.CallbackURL)));
            }

            await SetBasketModelAsync();

            return(Page());
        }