Rails OmniAuth invalid_credentials/404 callback despite success request log

Hello,

I am attempting to integrate Okta OIDC in my Rails app using Devise and OmniAuth. I am using the gem here: GitHub - omniauth/omniauth-okta: OAuth2 strategy for Okta with my authorize_url setup pointing to: https://my-dev-instance.okta.com/oauth2/v1/authorize

When “Sign in with Okta” is clicked, a POST is sent to land on my Okta dev instance’s login page. I login with valid credentials, but on the callback sequence, I get the following error:

ERROR -- omniauth: (okta) Authentication failure! invalid_credentials: OAuth2::Error, 
<!DOCTYPE html><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
...
<title>Page Not Found</title>
...

My callback url is successfully hit, but OmniAuth hits a failure condition.

OmniAuth indicates omniauth.error is a Okta 404 page, but the omniauth.error.type is invalid_credentials.

This is despite the fact that in the admin panel of my Okta instance, I can see that a successful OIDC login occurred in the system logs. Any help would be appreciated, or any more details I can provide.

Hey @eriksandfort, I had the same issue when I switched to the omniauth-okta gem, from the omniauth-oktaoauth gem. The omniauth-okta gem required the client_option ‘user_info_url’, which the omniauth-oktaoauth gem didn’t require. Once I set that option, it started working fine.