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 handle client-secret store on backend java spring boot #1451

Open
wanggewg opened this issue Mar 25, 2024 · 3 comments
Open

how to handle client-secret store on backend java spring boot #1451

wanggewg opened this issue Mar 25, 2024 · 3 comments
Labels
question Further information is requested

Comments

@wanggewg
Copy link

I am testing auth code flow with PKCE as Authorization Code Grant with Proof Key for Code Exchange (PKCE)

I have tried to put client_id and client_secret on spa page. everything works fine.
but that definitely not safe.
If I want to store client_secret on backend spring boot application.
what should I do ?

@pamapa pamapa added the question Further information is requested label Mar 26, 2024
@pamapa
Copy link
Member

pamapa commented Mar 26, 2024

With PKCE you do not need a client secret...

@wanggewg
Copy link
Author

wanggewg commented Mar 27, 2024

Thank you for your response!

Our AS request client secret, without secret , it will return 401 .
{
"error_description": "Invalid client or client credentials.",
"error": "invalid_client"
}
if I put secret in the config, then everything are fine, but we don't allow to put secret on javascript.

if oidc-client-js allow to manually separate code flow and authroize-code flow might help.
by the way , I really like this library. just did not figured out how to customize it to my needs.

@zach-betz-hln
Copy link

@wanggewg As mentioned, PKCE intentionally does not need a client_secret. Your identity provider should support this.

If for some reason they don't support it, as you alluded you, you'll have to workaround it, which is outside the scope of this issue.

But if it helps you in your investigation of workarounds, I've seen folks intercept the POST /authenticate call, either with a reverse proxy or dedicated backend endpoint, append the client_secret to the request body, send it to the identity provider, then forward the response to the SPA.

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

No branches or pull requests

3 participants