Use direct authentication when you want your application to directly authenticate users. For example, you don't want to delegate authentication to an IdP or authorization server using an HTTP redirect in a web browser. While delegating authentication is preferred, use direct authentication in situations where there's a high degree of trust between the user and your app.
Also, you can use direct authentication where usability constraints hinder the use of browser-based flows, such as mobile applications.
Direct authentication grant type flows use passwordless authentication, such as using Okta Verify and SMS. To use the direct authentication
flow, you must enable a non-password authenticator like
.
Open the Admin Console for your org.
Go to Security > Authenticators to view the available authenticators.
Do the following if
isn't in the list:
Click Add authenticator.
Click Add on the authenticator tile, and then click Add in the next dialog.
Verify the status of the authenticator.
Select the Enrollment tab.
Identify the authenticator and verify that the authenticator is set to either Optional or Required in the Eligible authenticators section of the Default Policy.
If the authenticator is set to Disabled, enable the authenticator.
Click Edit for the Default Policy.
Select Optional from the dropdown box for the authenticator.
grant type is automatically configured in your org authorization server. For custom authorization servers used with your app, you must enable
:
In the Admin Console, go to Security > API.
On the Authorization Servers tab, click the pencil icon next to the authorization server that you want to use.
Select the Access Policies tab.
Click the pencil icon from the Actions column for the Default Policy Rule to access the Edit Rule dialog.
Note: If you're using a different policy for your app, edit that policy instead.
Click Advanced in the IF Grant type is section.
Select
in the Okta direct auth API grants section (in addition to any other grant type that is already supported).
Click Update Rule.
Set up your app
Before you can implement authorization, you need to register your app in Okta by creating an app integration from the Admin Console.
Note: When you create or update an app, you must have super admin permissions to enable direct authentication grant types.
Open the Admin Console for your org.
Select Applications > Applications to view the current app integrations.
Click Create App Integration.
Select
as the Sign-in method.
Select Native Application as the Application type, then click Next.
Specify the App integration name.
Click Advanced in the Grant type section and select the
in addition to the defaults.
Select Allow everyone in your organization to access, then click Save.
From the General tab of your app integration, copy and save the generated Client ID value to implement your authorization flow.
Set up the authentication policy
In direct authentication flows, the client specifies a grant type that indicates the type of authenticator being used. However, the server can't grant a token until the client’s authentication policy is satisfied.
Note: This example creates a new app authentication policy with a
for testing purposes.
Go to your app’s Sign On tab, scroll to the bottom, and click View policy details.
Click Actions on the right of the Default Policy title and select Clone policy.
Click Actions again and select Edit name and description.
Name the policy (for example,
) and click Save.
Click Add a rule, name it (for example,
).
Specify your test user for AND User is.
Skip down to AND User must authenticate with and select
, and then click Save.
Open the application that you just created and select the Sign On tab.
Scroll to the User authentication section at the bottom and click Edit.
Select the authentication policy that you just created and click Save.