User authentication using zitadel end points #7498
Replies: 7 comments 7 replies
|
What is your use case scenario? If you want to invoke the API with a token, your regular/human user will have to authenticate themselves via a front-facing app like a web app/native app/mobile app and obtain a token. This token can then be used to invoke the API, which in turn will call the introspection endpoint to see if the token is valid and grant access to the API. If you want the user to be authenticated, you need to create a web app (or native app/mobile app) in the project. This will prompt the user to log in. If you only want to test the API or get a program to invoke the API, you need to get a token to do that. For that, you can create a service user and generate a token via client credentials of that service user or use a personal access token (PAT) that can be generated by ZITADEL as an access token. You can get an idea about the different scenarios via these blog posts: https://zitadel.com/blog/secure-logins-with-zitadel-part-1 |
|
@dakshitha - Thank you for providing a detail explanation. The current use case is to validate the token generated via a UI workflow. The need is to validate the token each time an API is invoked. As I mentioned I'm still trying to figure out how it works and what I'm trying to achieve here is authenticate a user by calling oauth/v2/token and then call the introspect end point. I don't have the UI project integrated with Zitadel , since would like to see if there is an option to generate a token via calling zitadel token end point and then have ensure if the user has access to this API project. |
|
@dakshitha - Using the following blog I was trying to authenticate against a UI app. https://zitadel.com/blog/secure-logins-with-zitadel-part-2 However as shown in step 2.3.2 I didn't get the Zitadel screen where the user is prompted with the login screen instead I got the Authorization code and PKCE result. Am I missing anything here? Zitadel version : v2.38.2 |
|
@dakshitha Thank you that worked, I didn't notice that :) I have mostly used Keycloak and trying to figure out how this works. I got the token from my UI app using the OIDC debugger and following the given below link to call the introspect url. https://zitadel.com/blog/api-access-and-introspection I've send the following data client_assertion_type I'm getting the following error "ErrorType=unauthorized_client Description=JWT assertion failed Parent=audience is not valid: Audience must contain client_id <Zitadel_URL>" Any idea what I could be missing here. |
|
Following the steps in the links given below. https://zitadel.com/blog/api-access-and-introspection I did a curl to introspect end point. curl --request POST |
|
@dakshitha Thank you, yes I did that but I was using jwt.io which had a default private key. I replaced that with the private key of my api application and now I'm always getting response as active "false". |
|
@dakshitha Thank you. I have added the following to the scope for the token end point while calling from OIDC debugger urn:zitadel:iam:org:project:id:{your_projectid}. What I'm trying achieve is, since I'm not using the actual UI app for getting my token I would be using the OIDC debugger to get the token, then call the introspect end point for checking if the same user has permission to API application. During this testing process as of now I'm not using a service account user instead I'm using my LDAP account. Hope that scenario works. Sample payload from OIDC debugger https://{your_domain}/oauth/v2/authorize curl --request POST |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm new to Zitadel and still trying to figure out different concepts. I have the following set up.
My need is to authenticate a user against a project.
I'm trying to use the oauth/v2/token and passed the client_id ,client_secret, grant_type (client_credentials) and passed the scope as openid profile email urn:zitadel:iam:org:project:id:5467856.
I'm assume the approach might be wrong but the idea was to get the user authenticated against the project id.
I see an end point oauth/v2/introspect should I use this end point for this. I tried this as well but couldn't get it working.
Any help on this is appreciated
All reactions