Activities of "surajlokhandemmew"

Well i dont want to show webview of login page instead i am using connect/token api to get the token using below method

` Future<AccessToken> fetchAccessToken({
    required String username,
    required String password,
    required String grantType,
    required String clientId,
    required String clientSecret,
    required String scope,
  }) async {
    final response = await http.post(
      Uri.parse('$api/connect/token'),
      headers: <String, String>{
        'Content-Type': 'application/x-www-form-urlencoded',
      },
      body: {
        'username': username,
        'password': password,
        'grant_type': grantType,
        'client_id': clientId,
        'client_secret': clientSecret,
        'scope': scope,
      },
    );


   if (response.statusCode == 200) {
      print(response.body);
      final accessToken = AccessToken.fromJson(json.decode(response.body));
      await storeAccessToken(accessToken.accessToken, accessToken.expiresIn);
      await storeRefreshToken(accessToken.refreshToken);
      return accessToken;
    } else {
      throw Exception("Invalid username or password");
    }
  }

and trying to authorize api using this method

`  Future<http.Response> get(String url) async {
    String? token = await authViewModel.getValidAccessToken();
    return http.get(
      Uri.parse(url),
      headers: {
        'Authorization': 'Bearer $token',
      },
    );
  }`

, you can try reproducing using postman just get the access token using connect/token api and use it as bearer token to access secured api it responds with login page 401 response, check screen shots

and can i please get quick reply , this issue is delaying my deadline.

ABP Framework version: v8.0.0

UI Type: MVC but this error is while consuming api on flutter app

Database System: MongoDB

Tiered (for MVC) or Auth Server Separated (for Angular): no

Exception message and full stack trace:

when i am trying to access api using bearer token its responding with login page

hi

Can you share the logs.txt file? liming.ma@volosoft.com

Thanks

shared

2024-01-03 06:11:54.834 +00:00 [INF] Initialized all ABP modules. 2024-01-03 06:11:54.924 +00:00 [INF] Initializing UI Database 2024-01-03 06:11:56.457 +00:00 [INF] Saving healthchecks configuration to database 2024-01-03 06:11:56.804 +00:00 [DBG] Waiting to acquire the distributed lock for saving external localizations... 2024-01-03 06:11:56.805 +00:00 [INF] Saving external localizations... 2024-01-03 06:11:56.877 +00:00 [DBG] Executing HealthCheck collector HostedService. 2024-01-03 06:11:56.970 +00:00 [INF] Start processing HTTP request GET https://..com/health-status 2024-01-03 06:11:56.973 +00:00 [INF] Sending HTTP request GET https://..com/health-status 2024-01-03 06:11:57.118 +00:00 [INF] Application started. Press Ctrl+C to shut down. 2024-01-03 06:11:57.118 +00:00 [INF] Hosting environment: Production 2024-01-03 06:11:57.118 +00:00 [INF] Content root path: C:\Users\Administrator\Desktop\laun 2024-01-03 06:11:58.102 +00:00 [INF] Request starting HTTP/1.1 GET https://..com/ - null null 2024-01-03 06:11:59.286 +00:00 [INF] Request starting HTTP/1.1 GET https://..com/health-status - null null 2024-01-03 06:12:02.316 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2024-01-03 06:12:02.316 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2024-01-03 06:12:02.357 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2024-01-03 06:12:02.358 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2024-01-03 06:12:02.363 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2024-01-03 06:12:02.363 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2024-01-03 06:12:02.364 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2024-01-03 06:12:02.364 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2024-01-03 06:12:02.365 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2024-01-03 06:12:02.365 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2024-01-03 06:12:02.770 +00:00 [DBG] Login Url: /Account/Login 2024-01-03 06:12:02.770 +00:00 [DBG] Login Return Url Parameter: ReturnUrl 2024-01-03 06:12:02.770 +00:00 [DBG] Logout Url: /Account/Logout 2024-01-03 06:12:02.770 +00:00 [DBG] ConsentUrl Url: /consent 2024-01-03 06:12:02.770 +00:00 [DBG] Consent Return Url Parameter: returnUrl 2024-01-03 06:12:02.770 +00:00 [DBG] Error Url: /home/error 2024-01-03 06:12:02.770 +00:00 [DBG] Error Id Parameter: errorId 2024-01-03 06:12:02.779 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader. 2024-01-03 06:12:02.779 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader. 2024-01-03 06:12:02.780 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens. 2024-01-03 06:12:02.780 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens. 2024-01-03 06:12:02.781 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader. 2024-01-03 06:12:02.781 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader. 2024-01-03 06:12:02.782 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm. 2024-01-03 06:12:02.782 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm. 2024-01-03 06:12:02.789 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString. 2024-01-03 06:12:02.789 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString. 2024-01-03 06:12:02.791 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2024-01-03 06:12:02.791 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2024-01-03 06:12:02.791 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2024-01-03 06:12:02.791 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2024-01-03 06:12:02.792 +00:00 [DBG] AuthenticationScheme: OpenIddict.Validation.AspNetCore was not authenticated. 2024-01-03 06:12:02.792 +00:00 [DBG] AuthenticationScheme: OpenIddict.Validation.AspNetCore was not authenticated. 2024-01-03 06:12:02.876 +00:00 [INF] Executing endpoint 'Health checks' 2024-01-03 06:12:02.984 +00:00 [INF] Request finished HTTP/1.1 GET https://..com/ - 302 null null 4850.4536ms 2024-01-03 06:12:02.990 +00:00 [INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET https://..com/, Response status code: 302 2024-01-03 06:12:03.293 +00:00 [INF] Request starting HTTP/1.1 GET https://..com/Error?httpStatusCode=404 - null null 2024-01-03 06:12:03.320 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2024-01-03 06:12:03.320 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2024-01-03 06:12:03.320 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2024-01-03 06:12:03.320 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2024-01-03 06:12:03.320 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2024-01-03 06:12:03.332 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. 2024-01-03 06:12:03.332 +00:00 [DBG] AuthenticationScheme: OpenIddict.Validation.AspNetCore was not authenticated. 2024-01-03 06:12:03.341 +00:00 [INF] Executing endpoint

** let me know if you need complete log couldnt paste here **

  • ABP Framework version: v8.0.0
  • UI Type: MVC
  • Database System: MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace: below is the log for your info let me know if you need complete log

2024-01-03 05:14:33.006 +00:00 [INF] Initialized all ABP modules. 2024-01-03 05:14:33.250 +00:00 [INF] Initializing UI Database 2024-01-03 05:14:35.056 +00:00 [INF] Saving healthchecks configuration to database 2024-01-03 05:14:35.224 +00:00 [INF] Saving external localizations... 2024-01-03 05:14:35.430 +00:00 [INF] Start processing HTTP request GET https://..com/health-status 2024-01-03 05:14:35.434 +00:00 [INF] Sending HTTP request GET https://..com/health-status 2024-01-03 05:14:35.726 +00:00 [INF] Application started. Press Ctrl+C to shut down. 2024-01-03 05:14:35.726 +00:00 [INF] Hosting environment: Production 2024-01-03 05:14:35.726 +00:00 [INF] Content root path: C:\Users\Administrator\Desktop\laun 2024-01-03 05:14:36.239 +00:00 [INF] Request starting HTTP/1.1 GET https://..com/ - null null 2024-01-03 05:14:37.512 +00:00 [INF] Request starting HTTP/1.1 GET https://..com/health-status - null null 2024-01-03 05:14:40.119 +00:00 [INF] Executing endpoint 'Health checks' 2024-01-03 05:14:40.189 +00:00 [INF] Request finished HTTP/1.1 GET https://..com/ - 302 null null 3950.5949ms 2024-01-03 05:14:40.192 +00:00 [INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET https://..com/, Response status code: 302 2024-01-03 05:14:40.337 +00:00 [INF] Request starting HTTP/1.1 GET https://..com/Error?httpStatusCode=404 - null null 2024-01-03 05:14:40.362 +00:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2024-01-03 05:14:40.403 +00:00 [INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared). 2024-01-03 05:14:40.891 +00:00 [INF] Executing ViewResult, running view ~/Views/Error/404.cshtml. 2024-01-03 05:14:41.003 +00:00 [INF] Bundling __bundles/Views.Error.DefaultErrorComponent.default.F15FCDEA56EC024E1CDCD86CA6B586D8.css (1 files) 2024-01-03 05:14:41.234 +00:00 [INF] > Minified /Views/Error/DefaultErrorComponent/default.css (230 bytes -> 168 bytes) 2024-01-03 05:14:41.237 +00:00 [INF] Bundled __bundles/Views.Error.DefaultErrorComponent.default.F15FCDEA56EC024E1CDCD86CA6B586D8.css (168 bytes) 2024-01-03 05:14:41.400 +00:00 [INF] Bundling __bundles/LeptonX.Global.3253AE0A9501A0665DAC7014DA5B2ED8.css (18 files) 2024-01-03 05:14:41.425 +00:00 [INF] > Minified /libs/abp/core/abp.css (1331 bytes -> 868 bytes)

below is the screenshot

  • Steps to reproduce the issue: create new project and host on iis with custom domain name
Zobrazeno od 41 do 45 z celkem 45 záznamů
Made with ❤️ on ABP v8.2.0-preview Updated on března 25, 2024, 15:11