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.

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 **

Showing 51 to 53 of 53 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13