Activities of "shobhit"

Question
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

We have to share Url with the client so that 1- identity page is the landing page 2- client need not to select tenant i.e. tenant is already selected based on query parameter 3- after identity verification user will redirect to angular app

How i can achieve this.

Below image represnt point 1, 2

Question
  1. ABP Framework version: v4.2.2
  2. UI type: Angular
  3. DB provider: EF Core
  4. Tiered (MVC) or Identity Server Separated (Angular): yes
  5. Exception message and stack trace: as per attached screen shot
  6. Steps to reproduce the issue:"

2 Problems: 1- Run ABP Suite. Below error occures. As yes we have valid license. 2- When Using CRUD Page Generator Angular UI is not getting generated even C# code is getting generated.

Answer

Hello @EngincanV, My API versioning problem solved as i followed sample and document both. Now challenge is when generating proxy in my angular application. i am getting errors in "api-version" params. please refer below screen shot. what i have to do to make sure that angular generated service proxy class have no issue.

Question
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

i have 1 scenario where api method receive request. for ex:

  1. update user details
  2. update user address in custom table
  3. call 3rd party api and update user details as point 1 done, api reuturn back to UI and point 2,3 happens in background.

Question: how i can achieve this scenario. Please share document and sample code.

Answer

Hi @Engincan V. i am using 4.2.2 and getting following error:

NOTE: i am using default application structure as per 4.2.2.

Hi @mliming, this is custom api implementation and this api used by our mobile app. Now challenge is, how to send back token to mobile app so that user can continue in the app.

  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

i am creating new api endpoint which allowes google auth token to be passed as input paramenter. my api method do all business check as per below code to check the token and register the user. Now question is how i can send idenitty auth token back to user so that it can be used with other api calls.

public async Task<string> RegisterExternalUserAsync(string LoginProvider, string token)
{
    //ClaimsPrincipal claimsPrincipal = new();
    IRestResponse restResponse = new RestResponse();

    if (LoginProvider == "Google")
    {
        var client = new RestClient("https://www.googleapis.com/oauth2/v2/userinfo");


        client.Timeout = -1;

        var request = new RestRequest(Method.GET);
        request.AddHeader("Accept", "application/json");
        client.AddDefaultHeader("Authorization", string.Format("Bearer {0}", token));
        restResponse = client.Execute(request);
    }

    if(restResponse == null)
    {
        return "Invalid Token";
    }

    CustomUserData data = JsonConvert.DeserializeObject<CustomUserData>(restResponse.Content);

    var result = await _signInManager.ExternalLoginSignInAsync(
        LoginProvider,
        data.id,
        isPersistent: true,
        bypassTwoFactor: true
    );

    if (!result.Succeeded)
    {
        var user = new Volo.Abp.Identity.IdentityUser(GuidGenerator.Create(), data.email, data.email, CurrentTenant.Id);

        await _userManager.CreateAsync(user);
        await _userManager.AddDefaultRolesAsync(user);

        if (!user.EmailConfirmed)
        {
            var clientUrl = _configuration["App:ClientUrl"];

            SendEmailConfirmationTokenDto emailConfirmationTokenDto = new()
            {
                AppName = "MVC",
                Email = data.email,
                ReturnUrl = clientUrl
            };

            await _accountAppService.SendEmailConfirmationTokenAsync(emailConfirmationTokenDto);
        }

        var userLoginAlreadyExists = user.Logins.Any(x =>
            x.TenantId == user.TenantId &&
            x.LoginProvider == LoginProvider &&
            x.ProviderKey == data.id);

        if (!userLoginAlreadyExists)
        {
            user.AddLogin(new Microsoft.AspNetCore.Identity.UserLoginInfo(
                    LoginProvider,
                    data.id,
                    LoginProvider
                )
            );

            await _userManager.UpdateAsync(user);
        }

        await _signInManager.SignInAsync(user,true,null);

        //TODO: return identity token back to user
    }
    else
    {   
        var identityUser = await _userManager.FindByEmailAsync(data.email);
        await _signInManager.SignInAsync(identityUser, true,null);

        //TODO: return identity token back to user
    }

    return string.Empty;
}

  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

user is not able to login if tenant has enabled email confirmation after user sign-up. As tenant has enabled setting later but user has already signed-up. how we can enable email confirmation process for all existing users?

Question
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Question: how to version API. i have done below changes but i am not getting swagger working:

1- Controller changes [RemoteService] [Area("app")] [ApiVersion("2")] [ControllerName("BPMMapping")] [ApiExplorerSettings(IgnoreApi = false)] [Route("api/v{version:apiVersion}/app/bpmmappings")] public class BPMMappingV2Controller : AbpController, IBPMMappingAppService { }

2- Host Module Changes

private static void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddApiVersioning(config => { config.DefaultApiVersion = new ApiVersion(1, 0); config.ReportApiVersions = true; config.AssumeDefaultVersionWhenUnspecified = true; });

        context.Services.AddControllers().AddNewtonsoftJson(options =>
        {
            options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
            options.SerializerSettings.TypeNameHandling = TypeNameHandling.Auto;
        });

        context.Services.AddMvc(options => {
            foreach (var outputFormatter in

options.OutputFormatters.OfType<ODataOutputFormatter>().Where(_ => .SupportedMediaTypes.Count == 0)) { outputFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/prs.odatatestxx-odata")); } foreach (var inputFormatter in options.InputFormatters.OfType<ODataInputFormatter>().Where( => _.SupportedMediaTypes.Count == 0)) { inputFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/prs.odatatestxx-odata")); } }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

        context.Services.AddAbpSwaggerGenWithOAuth(
            configuration["AuthServer:Authority"],
            new Dictionary&lt;string, string&gt;
            {
                {"EzpandCC", "EzpandCC API"}
            },
            options =>
            {
                options.CustomSchemaIds(x => x.FullName);
                options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo() { Title = "EzpandCC API V1", Version = "v1", Description = "API V1", });
                options.SwaggerDoc("v2", new Microsoft.OpenApi.Models.OpenApiInfo() { Title = "EzpandCC API V2", Version = "v2", Description = "API V2", });
                options.DocInclusionPredicate((version, desc) =>
                {
                    if (!desc.TryGetMethodInfo(out MethodInfo methodInfo)) return false;
                    var versions = methodInfo.DeclaringType.GetCustomAttributes(true).OfType&lt;ApiVersionAttribute&gt;().SelectMany(attr => attr.Versions);
                    var maps = methodInfo.GetCustomAttributes(true).OfType&lt;MapToApiVersionAttribute&gt;().SelectMany(attr => attr.Versions).ToArray();
                    version = version.Replace("v", "");
                    return versions.Any(v => v.ToString() == version && maps.Any(v => v.ToString() == version));
                });
            });

        context.Services.RegisterServiceIoc();
    }

3- Host Module --> OnApplicationInitialization() changes //----------new start ------------ app.UseSwagger(options => options.RouteTemplate = "swagger/{documentName}/swagger.json"); app.UseSwaggerUI(options => {

            options.DocumentTitle = "Aztute API";
            options.SwaggerEndpoint($"/swagger/v1/swagger.json", $"v1");
            options.SwaggerEndpoint($"/swagger/v2/swagger.json", $"v2");

            IConfiguration configuration = context.GetConfiguration();
            options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
            options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
        });
        app.UseEndpoints(endpoints => endpoints.MapControllers());

		//----------new end ------------

		//--------- default abp start -----------
		
        //app.UseSwagger();
        //app.UseSwaggerUI(options =>
        //{
        //    options.SwaggerEndpoint("/swagger/v1/swagger.json", "EzpandCC API");

        //    IConfiguration configuration = context.GetConfiguration();
        //    options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
        //    options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
        //});

4- Swagger response

Hello @Maliming. you are correct. there was some issue with azure service creation. i have created new instance and working as expected.

Showing 131 to 140 of 349 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30