Simple Authentication with Rails and OmniAuth

Simple Authentication with Rails and OmniAuth

Learn how to easily add user authentication into Rails apps using OmniAuth, devise, and Okta.

Chase Dougherty

This is legit. Pull down his project and set it up yourself though. What you need to know is your OKTA DOMAIN comes right before the .com in your OKTA URL. Mine was oktapreview because I was using a developer account. Then your OKTA_ORG is the dev-123445 number that is also in your OKTA URL. Once you can be 100% positive your application.yml has the right credentials, then you can set this up in your own project.

Kaitlyn Sapier

No idea what my issuer URL is :frowning: the rest of the config is fine.

“To get the OKTA_ISSUER value, use OKTA_ISSUER/oauth2/default, substituting your issuer URL in.”

andrew vanbeek

@kaitlynsapier the issuer is your auth server url, but most developer tenants you have one available so you can just make it https://yourorg.oktapreview/oauth2/default. Also this doc helps expain it: https://developer.okta.com/…

andrew vanbeek

@kaitlynsapier the issuer is your auth server url, but most developer tenants you have one available so you can just make it https://yourorg.oktapreview/oauth2/default. Also this doc helps expain it: https://disq.us/url?url=htt… . Let me know if that helps!!

Dave C-K

Can you add an article on how to use Okta with Devise?

Andrew Van Beek

Hi @daveck , the example in the video is actually using Omniauth in addition to Devise. The pattern would be just to simply add Omniauth with Devise. They are typically used together pretty commonly. Hope that helps. Also here is a gist: https://gist.github.com/and… for exactly that.

Mat Kramer

I guess that means OKTA_ISSUER is in the form https://dev-123456.oktapreview/oauth2/default.

Mat Kramer

I guess that means OKTA_ISSUER is in the form “https://dev-123456.oktapreview/oauth2/default”. Also discovered that default rails server port is 3000, so I used “rails s -p 5000”

Andrew Koch

This is confusing response from Okta server:
Description: The ‘redirect_uri’ parameter must be a Login redirect URI in the client app settings:

AFAIK this is set in the config/application.yml