- ABP Framework version: v8.0.1
- UI Type: Angular & MVC
- Database System: MySQL & MongoDB
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
Hi there, i have a question whether able to do a auto login / generate token onbehalf of client (without pw) after email confirmation flow during signup?
Any approach i can use to do? I am not familiar with AuthServer OpenIddict which abp supports it and our platform is using, is there any solution can achieve this?
15 Answer(s)
-
0
hi
https://abp.io/community/articles/implementing-passwordless-authentication-with-asp.net-core-identity-c25l8koj
-
0
but without user interaction, how to achieve it? after
await SignInManager.SignInAsync(user, isPersistent: false);
how to get access token? -
0
hi
You can add a custom grant type to get a token in the next request.
see https://abp.io/community/articles/how-to-add-a-custom-grant-type-in-openiddict.-6v0df94z
-
0
-
0
hi
Have you added the grant type to your client's permissions?
https://github.com/abpframework/abp/blob/3210f138454697647689b4868c8d4b7b3da02d44/modules/openiddict/app/OpenIddict.Demo.Server/EntityFrameworkCore/ServerDataSeedContributor.cs#L79
-
0
nope. how do i add this in AuthServer app?
-
0
hi
You can update your
OpenIddictDataSeedContributor
to add custom grant type to the application/client. -
0
Added custom grant type named "auto_token" to application/client
["ept:logout","gt:authorization_code","rst:code","ept:authorization","ept:token","ept:revocation","ept:introspection","scp:address","scp:email","scp:phone","scp:profile","scp:roles","gt:auto_token","scp:AccountService","scp:IdentityService","scp:AdministrationService","scp:SaasService","scp:ProductService"]
this is the result get from OpenIddictApplications permission column.
-
0
hi
Try to clear Redis.
If still not working please share the logs of authserver.
Thanks.
-
0
hi ya, i already clear redis and rerun, but still having same issue.
here are the logs from authserver.
[auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7378320Z level=info msg="Request starting HTTP/1.1 POST https://localhost:44322/connect/token - application/x-www-form-urlencoded 89" [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7396240Z level=debug msg="The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7397580Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7398460Z level=info msg="The request URI matched a server endpoint: Token." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7398590Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7398860Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7399110Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7399300Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7401030Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ExtractPostRequest`1[[OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7401280Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateClientAuthenticationMethod`1[[OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7401480Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ExtractBasicAuthenticationCredentials`1[[OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7401840Z level=info msg="The token request was successfully extracted: { [auth-server_ba5ce108-f]: 'grant_type': 'auto_token', [auth-server_ba5ce108-f]: 'u': '', [auth-server_ba5ce108-f]: 'redirect_uri': 'https://localhost:4200/', [auth-server_ba5ce108-f]: 'client_id': 'Angular' [auth-server_ba5ce108-f]: }." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7401910Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ExtractTokenRequest." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7402670Z level=info msg="The token request was rejected because the 'auto_token' grant type is not supported." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7402740Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ValidateTokenRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ValidateGrantType." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7402810Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ValidateTokenRequestContext was marked as rejected by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ValidateGrantType." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7402960Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ValidateTokenRequest." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7403010Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was marked as rejected by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ValidateTokenRequest." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7403230Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+AttachErrorParameters." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7403390Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+AttachCustomErrorParameters." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7403790Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+Exchange+NormalizeErrorResponse." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7404070Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+AttachHttpResponseCode`1[[OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7404270Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+AttachCacheControlHeader`1[[OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7404450Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+AttachWwwAuthenticateHeader`1[[OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7404590Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was successfully processed by Volo.Abp.Account.Web.ExtensionGrants.LinkLoginExtensionGrantProcessJsonResponse." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7404810Z level=info msg="The response was successfully returned as a JSON document: { [auth-server_ba5ce108-f]: 'error': 'unsupported_grant_type', [auth-server_ba5ce108-f]: 'error_description': 'The specified 'grant_type' is not supported.', [auth-server_ba5ce108-f]: 'error_uri': 'https://documentation.openiddict.com/errors/ID2032' [auth-server_ba5ce108-f]: }." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7406190Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ProcessJsonResponse`1[[OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7406280Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext was marked as handled by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ProcessJsonResponse`1[[OpenIddict.Server.OpenIddictServerEvents+ApplyTokenResponseContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7406370Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ApplyTokenResponse`1[[OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7406440Z level=debug msg="The event OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext was marked as handled by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ApplyTokenResponse`1[[OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext, OpenIddict.Server, Version=5.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]." [auth-server_ba5ce108-f]: ts=2024-08-12T04:55:51.7407760Z level=info msg="Request finished HTTP/1.1 POST https://localhost:44322/connect/token - 400 179 application/json;charset=UTF-8 3.2637ms"
-
0
-
0
-
0
hi
Can you create a new question? I will forward it to the angular team.
-
0
Hi there, regarding this issue, i pushed to server, it throws unauthorized_client, but in my record i had these
["ept:logout","gt:authorization_code","rst:code","ept:authorization","ept:token","ept:revocation","ept:introspection","gt:refresh_token","gt:password","gt:LinkLogin","gt:Impersonation","scp:address","scp:email","scp:phone","scp:profile","scp:roles","scp:gt:auto_token","scp:AccountService","scp:IdentityService","scp:AdministrationService","scp:SaasService","scp:ProductService"]
at Angular client
i cleared redis, but still having this issue.
{ "error": "unauthorized_client", "error_description": "This client application is not allowed to use the specified grant type.", "error_uri": "https://documentation.openiddict.com/errors/ID2064" }
-
0
gt:auto_token instead of scp:gt:auto_token