How to detect new users after signing in with Okta?

I’ve been following the Build a CRUD App with ASP.NET Core and Angular tutorial and it has been helpful with my integration with Okta. However, I couldn’t find any instructions on how my ASP.NET Core app can detect new users so that it force the user go through a custom signup flow (ie: specify a unique username, enter date of birth, agree to terms of service and privacy policy, etc.).

What is the best way of detecting new users?

I am assuming your .NET app does not store the local user profile in DB and you are storing the info back in Okta itself as part of the user profile. In which case, after login, just check the user info to see if any mandatory field already has a value or not - if the field has a value, user is not new, if the field does not have value, user is new and needs to be routed to the new user signup flow.

I need to store the user profile (eg: username, email address, etc) in my application’s database. Storing these details in Okta and not in my database will require an HTTP call to Okta’s API to retrieve my users’ profiles. Doing this will significantly reduce the performance of my application.

Does your advice still apply to my situation?

Hi @andrewliang

You can leverage Event Hooks which send details about an event to your web server when it occurred in Okta.

You can tailor the event to specific event that occurs in your Okta tenant for new users (eg. email change with specific debugContext when user passes the activation page).

@dragos, I don’t think I can use Event Hooks because the event is asynchronous but I might be able to use Inline Hooks, specifically the Registration Inline Hook because it’s synchronous. My registration event handler (that is external to Okta) can be used to create a new user in the database it and flag the user as new. When the user is redirect back to my app, I’ll check in the database if the user needs to go through my customized signup flow in my app. The event hook is similar but it can’t guarantee that the event hook handler will finish executing prior to a user redirect back to my app.

Am I understanding this correctly?