Activities of "DNarayanaswamy"

Hi , I have been trying to access this API by authenticating using OAUTH2.0 but Iam not successfull. I am getting 400-Bad Request Error. Here is the code I am using. Please call out if anything wrong done here.

[HttpGet]
public async Task<ActionResult<string>> GetLocationDetailsbyId()
{
        var tokenEndpoint = "https://test-authserver.azurewebsites.net/connect/token";
        var clientId = "TEST_Swagger";
        var clientSecret = ""; 
        var httpClient = _httpClientFactory.CreateClient();
        var formData = new Dictionary<string, string>
{
    { "grant_type", "password" },
    { "username", "*****" },         // User's username
    { "password", "*****" },      // User's password
    { "client_id", clientId },
    { "client_secret", clientSecret },
    { "scope", "TEST" }
};
        var tokenRequest = new FormUrlEncodedContent(formData);
        var tokenResponse = await httpClient.PostAsync(tokenEndpoint, tokenRequest);
        if (tokenResponse.IsSuccessStatusCode)
        {
            var tokenContent = await tokenResponse.Content.ReadFromJsonAsync<TokenResponse>();
            var accessToken = tokenContent?.access_token;
            // Now that you have the access token, you can use it to access the protected API
            var apiEndpoint = "https://test-api.azurewebsites.net/api/app/location/4640/location-details-by-id";
            var apiRequest = new HttpRequestMessage(HttpMethod.Get, apiEndpoint);
            apiRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
            var apiResponse = await httpClient.SendAsync(apiRequest);
            if (apiResponse.IsSuccessStatusCode)
            {
                var apiData = await apiResponse.Content.ReadAsStringAsync();
                return Ok(apiData);
            }
            else
            {
                return StatusCode((int)apiResponse.StatusCode, "API request failed.");
            }
        }
        else
        {
            return StatusCode((int)tokenResponse.StatusCode, "Token request failed.");
        }
}

I also tried to execute the same thing via postman, it says invalid scope. But I am entering right scope, refer the scopes displayed in Main project. This is the same thing entered in PostMan This says invalid scope in PostMan.

I also tried using TEST API, TEST TEST API as scopes but still same result. Can you please guide me here?

Hi, I have shared the full logs to your email. Please check. Thanks

Hi, I have implemented Inbox also still application is getting stuck when saving. And I have observed one behavior when I do a Save operation the application gets stuck but after some time few thousands of records are getting added in AbpEventOutbox table but after some time these records get disappeared in the table. Also these thousands of records are published to a Kafka topic I have configured.

Sample record that got added to AbpEventOutbox : { Id: DEE8596B-83BC-D8FC-44E3-3A0D7201312B ExtraProperties : {} EventName : Volo.Abp.Domain.Entities.Events.Distributed.EntityEto.Created EventData : {"entity":{"entityType":"Volo.Abp.EntityFrameworkCore.DistributedEvents.OutgoingEventRecord","keysAsString":"b2c05e79-323d-259b-cfa7-3a0d614ef330","properties":{}}}
}

Note: EventData is converted from byte to string

But I don't see any records getting added in AbpEventInbox table.

How should I proceed furthur.

Hi, I tried this approach it did not work, still Id coming up as 0.

Hi I have done the same, now the Application is running properly. But I dont see any records getting added in "AbpEventOutbox" which is created by ABP for outbox events when I modify/create entities.

The below code when added in ApplicationModule.cs class it is giving me syntax error. Plese refer below screenshot for more info.

顯示 6 個紀錄的 1 到 6 個.
Made with ❤️ on ABP v8.2.0-preview Updated on 3月 25, 2024, 15:11