Hey @Robert01, thanks for posting. I’m trying to figure out exactly what you’re trying to do.
There are a couple ways you can configure authentication:
You set your own cookie
You accept access_tokens sent by the user’s browser
If 1, you let the server start the redirect using a .NET OpenID Connect library (your user’s browser is redirected, then your server parses the results on the redirect uri). These libraries do correct validation for you, so you’ll just get the user info and store it in your own cookie. This is the authorization code flow.
If 2, you let the browser start the redirect (you could use okta-auth-js for this) to get an access_token. The browser is then expected to send that access_token in every request to your server. Each endpoint on your server should validate any access_token sent. This is the implicit flow.
Hi @lboyette, I am using the Okta authentication API to make a HTTP request with the username and password and obtaining an access token. From there, I followed the documents from Okta, to retrieve a session cookie via OpenID Connect Authorization Endpoint.
Reason why I am doing that is because we want to use our own custom login portal, and have the API just authenticate and create the Session cookie and then use that session cookie to literally login the user.
In regards to the scenario 1, does the parsed results in the redirect uri, need to have some code to receive the session?
Hi Robert,
I read your comments and need your help if you can.
We are using the same approach by calling the Authentication API to authenticate the user using Username and Password. But after that when we are stuck in creating the cookie in user’s browser using OpenID Connect Authorization Endpoint method.
Can you please share the code for how can we achieve that?
Please check out this document. In short, you would need to take the sessionToken from the response from /api/v1/authn and pass it in the browser to open a session in Okta.