Redirect user to Okta login page through Asp.Net MVC application Skip to main content
https://support.okta.com/help/answers?id=906f0000000i0iviak&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Vaibhav JoshiVaibhav Joshi 

Redirect user to Okta login page through Asp.Net MVC application

Hi,

How can we redirect user to Okta login page for authentication? We have referred Okta Music Store application which makes use of Login page within same project but we would like to redirect user to Okta for authentication.

https://github.com/okta/okta-music-store

Please suggest.
Thomas KirkThomas Kirk (Okta, Inc.)
You have a few options for application Single Sign On or SSO. The first is WS-Federation (https://support.okta.com/help/articles/Knowledge_Article/29510977-Configuring-the-Okta-Template-WS-Federation-Application). The second is SAML (http://developer.okta.com/docs/guides/saml_guidance). For SAML, check out the SAML library links at the bottom of the page. The third is OIDC (http://developer.okta.com/docs/api/resources/oidc), and it is a good client side only approach.

The last option is Okta API (http://developer.okta.com/docs/api/getting_started/design_principles.html) which is demonstarted with the music store.
Raphael LondnerRaphael Londner (Okta, Inc.)
Additionally, if you're looking at leveraging some code samples, we suggest that you start looking at more modern authentication methods, namely OpenID Connect.

We have one ASP.NET MVC example that leverages redirection to Okta for authentication with OpenID Connect and it's available at https://github.com/rlondner/okta-msoidc-sample

I also suggest that you take a look at our Early Access documentation page for OpenID Connect at http://developer.okta.com/docs/api/resources/oidc.html for more information.

We have another sample available at https://github.com/rlondner/okta-aspnet-spa_webapi-oidc, but that one uses a different OpenID Connect flow (namely the Implicit flow while the previous one uses the Authorization Code flow), as well as our Sign In Widget (http://developer.okta.com/docs/guides/okta_sign-in_widget.html) so the authentication is also done transparently in the browser without a redirection to the Okta portal.

If you do want to enable OpenID Connect on your development Okta organization, please contact our developer support at developers at okta dot com and let us know what your dev organization is so we can enable that feature for it.

 
Vaibhav JoshiVaibhav Joshi
Thanks Thomas and Raphael for the quick reply. We have referred to below ASP.NET MVC demo application.
 https://github.com/rlondner/okta-msoidc-sample

We are getting an error after updating configuration settings like Client Id, Client Secret, Redirect and Authority and when we try to get authenticated. Unable to corelate reason of error.

Is it because the Okta application which we created (through Okta portal configuration) earlier doesn't support Open Id Connect? When we try to create a new project / application in Okta, we can only see following options. Secure Web Authentication & SAML 2.0

How can we enable this existing application to support Open Id Connect?

Error that we are geeting from Okta : HttpRequestException: Response status code does not indicate success: 500 [IOException: Unable to get document from:https ://{Org}.okta.com/ oauth2 /v1/authorize/.well-known/ openid-configuration ] Microsoft.IdentityModel.Protocols.d__0.MoveNext() in c:\workspace\WilsonForDotNet45Release\src\Microsoft.IdentityModel.Protocol.Extensions\Configuration\HttpDocumentRetriever.cs:59