Okta React SDK

Learn how to properly mock client-side user authentication in React with Okta.

Why do we mock Okta?

Okta is an authentication service provider. This means that they license software that handles all things related to user authentication, including browser sign-in and sign-out, user sign-up, and the protection of routes that require authentication. In a testing environment, we definitely want to test that our code is behaving as we expect it to, given an authentication state. In other words, we might want to make sure that if a user is logged in, they can view their profile page, but if they are not logged in, they see an “unauthorized, please log in” screen. Since we don't have a browser or actual users logging in and out, we mock it.

Get hands-on with 1200+ tech skills courses.