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

'bytes' object has no attribute 'verify' #486

Open
michaelschem opened this issue Feb 28, 2023 · 4 comments
Open

'bytes' object has no attribute 'verify' #486

michaelschem opened this issue Feb 28, 2023 · 4 comments

Comments

@michaelschem
Copy link

I believe I've got everything setup correctly, but I get the error:

AttributeError at /oidc/callback/
'bytes' object has no attribute 'verify'

Configurations:

AUTHENTICATION_BACKENDS = (
    'mozilla_django_oidc.auth.OIDCAuthenticationBackend',
    # ...
)

OIDC_RP_IDP_SIGN_KEY = "https://[REDACTED].okta.com/oauth2/v1/keys"
OIDC_RP_CLIENT_ID = "[REDACTED]"
OIDC_RP_CLIENT_SECRET = "[REDACTED]"
OIDC_OP_AUTHORIZATION_ENDPOINT = "https://[REDACTED].okta.com/oauth2/v1/authorize"
OIDC_OP_TOKEN_ENDPOINT = "https://[REDACTED].okta.com/oauth2/v1/token"
OIDC_OP_USER_ENDPOINT = "https://[REDACTED].okta.com/oauth2/v1/userinfo"
OIDC_RP_SIGN_ALGO = "RS256"
@sixsax
Copy link

sixsax commented Jul 19, 2023

I also using RS256. I got this error when using "OIDC_RP_IDP_SIGN_KEY". So i commented out it in favor of "OIDC_OP_JWKS_ENDPOINT" to get it works fine.
It is important to commented out "OIDC_RP_IDP_SIGN_KEY" beacuse it has precendece on "OIDC_OP_JWKS_ENDPOINT".

I have no idea why "OIDC_RP_IDP_SIGN_KEY" cause exception, but seems to be related to how mozilla-django-oidc pass "key" argument to josepy library.

I'm usin Keycloak, on okta you could see at following link probably: https://developer.okta.com/docs/reference/api/apps/#list-json-web-keys

I'm using following versions:
Django==4.2.3
mozilla-django-oidc==3.0.0
josepy==1.13.0

@diogosilva30
Copy link

diogosilva30 commented Aug 5, 2023

I'm having the same error with Auth0 and using OIDC_RP_IDP_SIGN_KEY

@delnet72
Copy link

delnet72 commented Jan 2, 2024

Ditto. Thanks @sixsax for the workaround.

@JulienFS
Copy link

The ̀OIDC_RP_IDP_SIGN_KEY is meant to contain a public key, not an URL to the key endpoint of your provider.
You get this 'bytes' object has no attribute 'verify' error because the URL cannot be parsed into a proper public key and defaults to a byte-like key (a bit more context here : #505 (comment))

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

No branches or pull requests

5 participants