I would like to get some help from you since I've being searching all around and I can not find the solution for my question,
My use case is the next one:
I have an application developed in ABP 6 and using Angular UI, in the login I have a button which allows me to redirect to a SAML identity provider which is returning a code, I redirect the SAML application to a route in my Angular app and I read the incoming parameters to call a backend endpoint and get the email of the user that succeeded the SAML login process,
So now, I need to get this email, search if this exists in my users table and then generate an access token for that user, as you can see I am not able to use the user password, and I need to generate the token based on the user since in the whole application I am using some claims that are included in the token that is generated with the default password flow
I've being following the tutorial recommended for the community Implementing passwordless authentication with asp.net core, but this is specific for MVC application.
I found the method GenerateUserTokenAsync
but it returns a token as string with 5 numbers, and as far as I understand the result of the request to connect/token
is aJSON with the access_token, refresh_token and some other keys
Does someone have an idea or solution for this? Thanks!
- ABP Framework version: 6.0
- UI Type: Angular
- Database System: EF Core (SQL Server)
- Auth Server Separated (for Angular): yes
8 Answer(s)
-
0
hi
What the AuthServer are you using now?
Identity Server or OpenIddict
-
0
Hello, I am using OpenIddict as Auth Server
-
0
hi
https://support.abp.io/QA/Questions/6625/Create-user-access-token-JWT-Bearer-manually-on-openId--abp-8 https://community.abp.io/posts/how-to-add-a-custom-grant-type-in-openiddict.-6v0df94z
-
0
-
0
hi
Are you calling your app service method from the authserver website?
Because this options set by auth server website
-
0
hi
Are you calling your app service method from the authserver website?
Because this options set by auth server website
Hello, I moved the code to the right project, now I am able to generate the token, however when I try to use that token in my API calls the response is Unauthorized, am I missing something else?
-
0
Hello I was able to generate the token, I had to include the expire date, not a null value, thanks for the support, however the issue is now on angular side,
When I try to validate the token with
OAuthService.hasValidAccessToken()
it returns false, as far as I can seeAuthGuard
of abp is using that method internally, for that reason the routes are not active and I am not able to login even with the tokenI am not sure about the real issue since I have tested the token in ThunderClient and the API responds correctly to it.
-
0
hi
This is the source code of
OAuthService.hasValidAccessToken()
https://github.com/manfredsteyer/angular-oauth2-oidc/blob/0211482b52df1f553c278acc812d86f39b04c97e/projects/lib/src/oauth-service.ts#L2420-L2436
You can override the
AuthGuard
to custom the logic.