omniauth / omniauth_openid_connect

MIT License
157 stars 186 forks source link

Could not authenticate you from [My Provider name] because "Unknown" #171

Open habin201291 opened 6 months ago

habin201291 commented 6 months ago

Hi!

I am using doorkeeper-openid_connect gem as an OIDC provider.

When I clicked on the Login button at the client and got an error below: Could not authenticate you from Docerfy because "Unknown". Docerfy is name of OIDC provider.

My configurations in Devise.rb file below: config.omniauth :openid_connect, { name: :docerfy, issuer: "https://774e-117-3-70-40.ngrok-free.app/", scope: [:openid, :email], response_type: :code, uid_field: "preferred_username", require_state: false, client_options: { port: 443, scheme: "https", host: "774e-117-3-70-40.ngrok-free.app", authorization_endpoint: "/oauth/authorize", token_endpoint: "/oauth/token", identifier: "BYUfnhIsbHuRb5Fs638WZdQZCGhEboVREiL3yAtthQw", secret: "nsccbh5P3y3ovKOEVUBsw23HW-mt0gtJfQFdBl_AOwA", redirect_uri: "https://a683-117-3-70-40.ngrok-free.app/users/auth/docerfy/callback", }, }

I am quite confused because I do not know if the error lies in these gems or from somewhere else.

Hope this help!

davidwessman commented 6 months ago

I would recommend using discovery: true if possible, helped me with a lot of issues. But only if your provider supports discovery.

habin201291 commented 6 months ago

I would recommend using discovery: true if possible, helped me with a lot of issues. But only if your provider supports discovery.

It seems to be working, thank you very much, but I have another problem. The OIDC client returned the following error: Undefined method with_indifferent_access for "<a href=\"https://3e90-117-3-70-40.ngrok-free.app/oauth/discovery/keys\">temporary redirect</a>.\n\n":string

And the link above shows a json like: {"keys":[{"kty":"RSA","n":"wVRCGZ4KEqa1OwECAhupl0KoaPd8nYFi94IsjdcRrZkYG_s7a248s5r1mw_OBE5OIvkVFUCOIY_vXQcx-KFawTFrWhOvIffSqy6i7pMRDGB78J-teW5XvbtB4nhSy3wWtuYi9cIlbcFT2n3pJLCKLj_wss_MWkBTZpZtB2ynqe6MgjZevkbLIAEGroMYlrTX2ijFcrJYKO7mJMWfzO8_lKeu2tG9IKL-epC-72oMpCP95cs8_e7xSlI7VBX5nsl_8490oom2ISu5mK-aWIppvgQlRoG4_61EI50P53pr3xJTle3M1BpV-AFOlKLHZmME_g3bjhlIXcU6mcL9kYd56w","e":"AQAB","kid":"dtXls8aranECkXUaG8BBFsOZJVAbys7hLQnqGp1Qv0I","use":"sig","alg":"RS256"}]}

davidwessman commented 6 months ago

Does your IDP-provider support the .well-known/openid-configuration endpoint? For example: https://accounts.google.com/.well-known/openid-configuration

Seems like some ruby-gem expects an array and not another link