When I send a requestion and pass the previous bearer token, still the user considered anonymous (even if it was admin) So when I debug the app, the ICurrentuser says this is anonymouse user!
I tried what you suggested, did not work :
eyJhbGciOiJSUzI1NiIsImtpZCI6IkVERDgzNzQ1NDA0QjdBMUYwOEQ2MjZBMEZGQTUyMjU2ODk4Mzg0MjciLCJ4NXQiOiI3ZGczUlVCTGVoOEkxaWFnXzZVaVZvbURoQ2MiLCJ0eXAiOiJhdCtqd3QifQ.eyJzdWIiOiIyOWQzZGI4YS1mY2RhLTA0YjUtZDdjMC0zYTEwOWM4MGY1OGEiLCJnaXZlbl9uYW1lIjoiKzk2NjUxMTIyMjIyMiIsImVtYWlsIjoiKzk2NjUxMTIyMjIyMkBtYWlsLmNvbSIsInRlbmFudGlkIjoiYmY2YzY4MTgtMWM0OC0xMDU3LWQwNGQtM2ExMDljODBmMGY2Iiwic2NvcGUiOiJhZGRyZXNzIGVtYWlsIHBob25lIHJvbGVzIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MgTmVlbEJvb2siLCJ1bmlxdWVfbmFtZSI6Iis5NjY1MTEyMjIyMjIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiIrOTY2NTExMjIyMjIyIiwiZW1haWxfdmVyaWZpZWQiOiJGYWxzZSIsInBob25lX251bWJlcl92ZXJpZmllZCI6IkZhbHNlIiwib2lfcHJzdCI6Ik5lZWxCb29rX0FwcCIsImNsaWVudF9pZCI6Ik5lZWxCb29rX0FwcCIsImV4cCI6IjE3MDgyMDk1MDYiLCJyb2xlIjpbIkFkbWluIiwiTWFuYWdlciIsIk93bmVyIl0sImF1ZCI6Ik5lZWxCb29rIiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzODYiLCJpYXQiOjE3MDc1ODYyODl9.ujXEXG0GlWljvPDQL6Mi4nO5K2CLF5B2Ps-IlS0JoIBQSYsXM9FDwh3urVcP3qCNDn5VCvdJPBhZeHk5zq3xVFTjVgQoDIctjiS50cgLiwwzxgFLvnNcSn1LIRh6Bu9SH7HrWe8XdJrBGplDY2Ya7Qs2L6j1UGNc6-au80wU-_Fl6O2K0WK0LxEZAUpj3LmqGmVzM3aphLg2dViDACmzQO5cUQFVZpNPLxX5_sCsKemRViL0GbtDwfnlW7hsaRCAjbUtf56KzIsdn9Mx4W9S3IJNmDTIMApMVhDI9Fk234MXMX-D79FMFe8dnUdz4k-xkaJrasW6m3Z1a3I_IzOGPA
this is the decoded version :
{
"sub": "29d3db8a-fcda-04b5-d7c0-3a109c80f58a",
"given_name": "+966511222222",
"email": "+966511222222@mail.com",
"tenantid": "bf6c6818-1c48-1057-d04d-3a109c80f0f6",
"scope": "address email phone roles profile offline_access NeelBook",
"unique_name": "+966511222222",
"preferred_username": "+966511222222",
"email_verified": "False",
"phone_number_verified": "False",
"oi_prst": "NeelBook_App",
"client_id": "NeelBook_App",
"exp": "1708209506",
"role": [
"Admin",
"Manager",
"Owner"
],
"aud": "NeelBook",
"iss": "https://localhost:44386",
"iat": 1707586289
}
It looked worked but it did not, for example I got this access token :
eyJhbGciOiJSUzI1NiIsImtpZCI6IkRGNUUwQkU2QUEzQkUxRDFGMDNCRDc0NjQyOEUyQTY4QzBGRUMwRjgiLCJ4NXQiOiIzMTRMNXFvNzRkSHdPOWRHUW80cWFNRC13UGciLCJ0eXAiOiJhdCtqd3QifQ.eyJzdWIiOiI4NjYwYmUyYy04NzcxLTU4ZTQtMzA1ZC0zYTEwOGQ1NjA3MDIiLCJnaXZlbl9uYW1lIjoiKzk2NjUxMTIyMjIyMiIsImVtYWlsIjoiKzk2NjUxMTIyMjIyMkBtYWlsLmNvbSIsInJvbGUiOiJBZG1pbixNYW5hZ2VyLE93bmVyIiwidGVuYW50aWQiOiI1NmNkYTkzMi1kMjNjLTdjYzAtOWM2Zi0zYTEwOGQ1NWU1YWQiLCJzY29wZSI6ImFkZHJlc3MgZW1haWwgcGhvbmUgcm9sZXMgcHJvZmlsZSBvZmZsaW5lX2FjY2VzcyBOZWVsQm9vayIsImF1Z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2VybmFtZSI6Iis5NjY1MTEyMjIyMjIiLCJlbWFpbF92ZXJpZmllZCI6IkZhbHNlIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJvaV9wcnN0IjoiTmVlbEJvb2tfQXBwIiwiY2xpZW50X2lkIjoiTmVlbEJvb2tfQXBwIiwiZXhwIjoiMTcwODIwOTUwNiIsImF1ZCI6Ik5lZWxCb29rIiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzODYiLCJpYXQiOjE3MDc0MjQxNzF9.pVP9dLLbGjU3LFP6wlKiVqPleDaw8H1xhO24txamOiBpH-xhJ8dmK-HjUipGmg9VJLimK5Q5zzZzkRIC1OwKCtvM-vfLb2hek514EKqCwNmcpQ-HsEF2m2i8zcGfvDJILKkv0fEWej0LBiblw1oCxxCUCs6VZJ07H86p8UYBbq6Tv4M4EMncGHWu1zbt_8yJ_uQXt_5-2E9p7qPo54s3fVPDy6-NrPMjBs6Jt5EP0DKhJ86TLus3hIGyQknq57aQDZMtr5_RK0un6RegezKN1j_u6-jJxUxAK3QmPp1S1OaG_WtMf4Nm1A6L9GsHXwCXSVEI5BUe8p0yEuOCR_3JsA
When I use the token , the user looks anonymous!
Thank you for your response but that does not answer my question,
As I said, I am in the application layer, I would like to create a token for a user, I have the username only (of course I do not have the password, I only have the username)
I need more informatio how to implement this requirements:
I am looking for simple way like using similar interface for example:
public interface ITokenService
{
Task<string> GenerateTokenAsync(IdentityUser user, string tokenType);
}
I created a blank abp app as following:
I need to add 2 functions (generate token + generate refresh token) , these will be used by mobile app
Please suggest the best simple way of how to create 2 functions, previously I had a code that creates the token when I was using identity server 4 , now I am using the new framework : openid
(I do not perfer to add account module source code) + ( I perfere to create the function on myApp.Application layer or myApp.HttpApi layer)
I tried this code but did not work, it generated some token but did not work:
string getToken(Volo.Abp.Identity.IdentityUser user, string tokenType)
{
var authServer = configuration["AuthServer:Authority"];
var options = oidcOptions.CurrentValue;
//var roles = user.Roles.Select(r=>r.RoleId)
var descriptor = new SecurityTokenDescriptor
{
Claims = new Dictionary<string, object>
{
{ "sub", user.Id.ToString() },
{ "scope", MainScope.Split(',') },
{ "tenantid", user.TenantId?.ToString() },
//{ "role", user.Roles.Split(',') },
},
EncryptingCredentials = options.DisableAccessTokenEncryption
? null
: options.EncryptionCredentials.First(),
Expires = DateTime.UtcNow.AddMinutes(lifetime),
IssuedAt = DateTime.UtcNow,
Issuer = authServer,
SigningCredentials = options.SigningCredentials.First(),
TokenType = tokenType,
};
var accessToken = options.JsonWebTokenHandler.CreateToken(descriptor);
return accessToken;
}
Thank you
I installed abp version 5.2.0, Cannot use abp suite to create new project on specific version
D:\app>abp suite [10:38:31 INF] ABP CLI (https://abp.io) [10:38:32 INF] Version 5.2.0 (Stable) [10:38:33 WRN] ABP CLI has a newer stable version 8.0.0, please update to get the latest features and fixes. [10:38:33 WRN] [10:38:33 WRN] Update Command: [10:38:33 WRN] dotnet tool update -g Volo.Abp.Cli [10:38:33 WRN] Starting Suite v5.2.0 ... Opening http://localhost:3000 Press Ctrl+C to shut down. [10:40:08 ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }
[10:40:08 ERR] Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.Cli.ProjectBuilding.Templates.RemoveUnnecessaryPortsStep.RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\Templates\RemoveUnnecessaryPortsStep.cs:line 56 at Volo.Abp.Cli.ProjectBuilding.Templates.RemoveUnnecessaryPortsStep.Execute(ProjectBuildContext context) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\Templates\RemoveUnnecessaryPortsStep.cs:line 15 at Volo.Abp.Cli.ProjectBuilding.Building.ProjectBuildPipeline.Execute() in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\Building\ProjectBuildPipeline.cs:line 19 at Volo.Abp.Cli.ProjectBuilding.TemplateProjectBuilder.BuildAsync(ProjectBuildArgs args) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\TemplateProjectBuilder.cs:line 120 at Volo.Abp.Cli.Commands.NewCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\NewCommand.cs:line 73 at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Services.SolutionService.CreateSolutionAsync(CreateSolutionModel input) at lambda_method1665(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Dear, Regarding: How can we change the sms confirmation code length, currently it is 6 digits how can I make it longer or shorter?
I read the article you shared with me, it does not says how to change the number of digits, would you please provide me with simple direct answer? It is 6 digits I wanted to be 4 digits
Thank you
Dear about the point 2 I am trying to make this in angular, I am trying to reuse (send-securiy-code) but when the user clicks on login (or any account related action), it is redirected to the backend, so I do not know how to use the Account module in angular.
I want to make the (Passwordless authentication) in angular and when I get the token from backend, I suppose there is a way to replace the token in front end
Ok Thank you You answered my question regarding the backend, My Question in front end UI is in Angular app
I have an issue with poor documentation with abp modules which I have without source code; For example the chat module, I read the article (https://docs.abp.io/en/commercial/latest/modules/chat) but I was not able to:
How can I appy such customizations?