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 can I capture the access token and send request with authorization bearer? #96

Closed
alirf81 opened this issue May 5, 2022 · 6 comments
Assignees
Labels
need triage question Further information is requested

Comments

@alirf81
Copy link

alirf81 commented May 5, 2022

Hi!
Thank you for your contribution.

I am trying to use caddy-security with Keycloak as IDP and it seems like work well for browser login.
But I have some API clients and want to get access token and send request with authorization bearer set in header.

Can you kindly guide me how I can make this?

@alirf81 alirf81 added need triage question Further information is requested labels May 5, 2022
@greenpau
Copy link
Owner

greenpau commented May 5, 2022

@alirf81 , here is info on bearer token https://authp.github.io/docs/authorize/token-discovery

and API auth https://authp.github.io/docs/authenticate/misc#authenticate

Is this what you are looking for?

@alirf81
Copy link
Author

alirf81 commented May 5, 2022

yes, looks great. thank you!
Does this JSON authenticate API work for Keycloak IDP?
Btw, I have one more issue, it uses the JWT and it seems a bit long.
Can we use any other token which is shorter?

@greenpau
Copy link
Owner

greenpau commented May 5, 2022

Can we use any other token which is shorter?

@alirf81 , in settings, create API key for a user. Then enable API key usage on your authorization policy. https://authp.github.io/docs/authorize/basic_api_key_auth

After that, you can pass API key via X-API-Token header in a request.

@alirf81
Copy link
Author

alirf81 commented May 5, 2022

  1. Does JSON Authenticate API works when I use Keycloak IDP? https://authp.github.io/docs/authenticate/misc#authenticate
  2. I cannot access setting page, I can see portal page in /auth/portals but cannot see setting page under /auth/settings
  3. Are there JSON API for setting API token programmatically?
    Kindly give me your comment pls.

@greenpau
Copy link
Owner

greenpau commented May 7, 2022

@alirf81 , FYI, Keycloak docs are here: https://authp.github.io/docs/authenticate/oauth/backend-oauth2-0011-keycloak#realm-roles

Does JSON Authenticate API works when I use Keycloak IDP? https://authp.github.io/docs/authenticate/misc#authenticate

No.

I cannot access setting page, I can see portal page in /auth/portals but cannot see setting page under /auth/settings

That page only works with "local" identity store. I have #23 issue in my backlog. The gist is connecting OAuth-authenticated users to "local" identity store.

Are there JSON API for setting API token programmatically?

Not at the moment.

@greenpau greenpau closed this as completed May 7, 2022
@greenpau
Copy link
Owner

@alirf81, I am looking to add testimonial sections to https://authcrunch.com. Could you please write one and send it to me at greenpau@outlook.com?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants