mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 09:13:19 +03:00
🐛 Bug Report: Cloudflare Zero Trust OIDC: "Failed to verify oidc token with fresh keys" #73
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aepuck on GitHub.
Reproduction steps
I followed the steps as noted in https://pocket-id.org/docs/client-examples/cloudflare-zero-trust and I'm able to save the OIDC client in my instance and in Zero Trust.
Expected behavior
Successful authentication into Cloudflare via my Pocket ID instance.
Actual Behavior
When I click "Test" following the setup, I'm presented with the following message:
Version and Environment
Version 1.7.0
Instance is proxied itself through Cloudflare Tunnels, but not sure if that is an issue after looking at #231
Log Output
No response
@JonasWinter commented on GitHub:
I remember having the same error, but unfortuantely cannot remeber how I solved it. For comparison: This is the rest of my configuration. Did you set OIDC Claims and Scopes correct? What happens when activating PKCE?
@aepuck commented on GitHub:
I should note also that Pocket ID is working (quite well too!) with my WordPress instance and FileBrowser Quantum, but ZT is still vexing me...
@aepuck commented on GitHub:
@JonasWinter I just tried this above - enabled PKCE in both ZT and the Pocket ID registration added the three claims (scopes were already good) - but now I have a different message when I hit test:
After regenerating the client secret, I get the same message as before:
@aepuck commented on GitHub:
Sure thing!
Here is my OIDC provider setup from ZT > Settings > Authentication (subdomain redacted):
From Pocket ID > OIDC Clients:
My actual instance (on Win x64) is on a CF Tunnel as well, running as follows:
@kmendell commented on GitHub:
Can you share what you configured in cloudflare? Redact any sensitive information where needed. I have this setup and working, so im sure it may just be a miss-configuration issue.
@JonasWinter commented on GitHub:
@aepuck commented on GitHub:
@JonasWinter it is reachable to the internet anonymously, yes. (I do not have a Zero Trust application set up for my instance, just the tunnel exposing it to the internet.) I also turned on PKCE in the Pocket ID config when I tweaked things above.
Let me know if I need to share any further details from my Cloudflare or Pocket ID setups/configs.
@stonith404 commented on GitHub:
@aepuck Can you share the output of
<your-pocket-id-domain>/.well-known/openid-configuration?Also, please share your
.envfile, but make sure to redact any sensitive information.@JonasWinter commented on GitHub:
Just compared all configs, everything seems right. 2 things to check:
"You can find your team name in Zero Trust under Settings > Custom Pages."
@aepuck commented on GitHub:
@JonasWinter confirmed both the team name is correct and Bot Fight Mode is off. (I turned it off when I set up the WordPress OIDC plugin after seeing it cause an issue)
Thanks for your help on this though!!
@kmendell is there anything in my config that you'd do differently by chance?
@aepuck commented on GitHub:
@mitchplze many thanks for that, unfortunately still no dice 😫
@stonith404 @kmendell for grins just a bit ago, I went to the
/api/oidc/tokenendpoint in my browser to see if there would be any sort of output and I got this:I'm not sure if this is intended behavior when going to that URL but maybe (maybe?) it's related...despite two other OIDC authenticated apps working with my instance. This is a head scratcher for sure.
@mitchplze commented on GitHub:
Just chiming in that my CF ZT has worked great with this config pair out of the box, for quite some time.
I see that your app launcher tile URL is different (should probably not have the callback stuff on it), but that doesn't seem to break anything when I tested today.
@kmendell commented on GitHub:
Based on what i can see its setup the same as mine is, id have to check 100% though. Ill try to do that later.
@mitchplze commented on GitHub:
My working one looks the same in browser at that URL.
I actually have two or three diff CF ZT accounts connecting to multiple Pocket OIDC clients like this, no issues.
Give this rule a try. I had issues with various monitoring tools, web apps etc. not working with the CF 'orange cloud' turned on, until I did this.
Disclaimer: Do this at your own risk obviously. You're bypassing a lot of the benefit of CF with this admittedly.
@aepuck commented on GitHub:
@stonith404 sure thing! Here's the
openid-configuration, with redacted domain:{"authorization_endpoint":"https://id.domain.com/authorize","authorization_response_iss_parameter_supported":true,"claims_supported":["sub","given_name","family_name","name","email","email_verified","preferred_username","picture","groups"],"code_challenge_methods_supported":["plain","S256"],"device_authorization_endpoint":"https://id.domain.com/api/oidc/device/authorize","end_session_endpoint":"https://id.domain.com/api/oidc/end-session","grant_types_supported":["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:device_code"],"id_token_signing_alg_values_supported":["RS256"],"introspection_endpoint":"https://id.domain.com/api/oidc/introspect","issuer":"https://id.domain.com","jwks_uri":"https://id.domain.com/.well-known/jwks.json","response_types_supported":["code","id_token"],"scopes_supported":["openid","profile","email","groups"],"subject_types_supported":["public"],"token_endpoint":"https://id.domain.com/api/oidc/token","userinfo_endpoint":"https://id.domain.com/api/oidc/userinfo"}And my
.env:# See the documentation for more information: https://pocket-id.org/docs/configuration/environment-variables APP_URL=https://id.domain.com TRUST_PROXY=true MAXMIND_LICENSE_KEY=LicenseKeyRedacted PUID=1000 PGID=1000@stonith404 commented on GitHub:
I'm converting this to a discussion because this doesn't seem like an issue of Pocket ID itself, but a configuration issue.
@pew commented on GitHub:
@aepuck you can do this using Tunnels
@aepuck commented on GitHub:
@mitchplze I don't know if I'll be able to do that since I use CF Tunnels as my reverse proxy for my Pocket instance.