Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Che REST API with Authorization token? #23381

Open
lthomas122 opened this issue Mar 7, 2025 · 1 comment
Open

How to use Che REST API with Authorization token? #23381

lthomas122 opened this issue Mar 7, 2025 · 1 comment
Labels
kind/question Questions that haven't been identified as being feature requests or bugs. team/A This team is responsible for the Che Operator and all its operands as well as chectl and Hosted Che

Comments

@lthomas122
Copy link

lthomas122 commented Mar 7, 2025

Summary

Problem

I'm struggling to interact with the REST API. Every endpoint redirects me to the Che sign in page.

Steps Taken

Get the JWT from keycloak:

curl --location 'https://keycloak.<che_url>/realms/che/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<client_id> \
--data-urlencode 'client_secret=<client_secret>' \
--data-urlencode 'scope=openid email profile' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=<username>' \
--data-urlencode 'password=<password>' \
--data-urlencode 'redirect_uri=https://<che_url>/oauth/callback'

Then use the token on an API endpoint:

curl --location 'https://<che_url>/api/user/id' \
--header 'Authorization: Bearer <jwt_token>' \

I've tried the whole jwt, the id_token and the access_token, but every time the request redirects me to the Che login page

Relevant information

Che is deployed on AWS EKS using Kubernetes

@lthomas122 lthomas122 added the kind/question Questions that haven't been identified as being feature requests or bugs. label Mar 7, 2025
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Mar 7, 2025
@akurinnoy akurinnoy added team/A This team is responsible for the Che Operator and all its operands as well as chectl and Hosted Che and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Mar 7, 2025
@akurinnoy
Copy link
Contributor

@tolusha @olexii4 folks, please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Questions that haven't been identified as being feature requests or bugs. team/A This team is responsible for the Che Operator and all its operands as well as chectl and Hosted Che
Projects
None yet
Development

No branches or pull requests

3 participants