Resolving the RDP (401) Unauthorized Error in the Okta MFA Credential Provider
Last Updated:
Overview
When attempting to sign in via Remote Desktop Protocol (RDP) using the Okta MFA Credential Provider, users encounter a Multi Factor Authentication Failed message in the UI. The full error appears in the OktaWidget.log as:
exception thrown is = System.Net.WebException: The remote server returned an error: (401) Unauthorized.<CR><LF> at System.Net.HttpWebRequest.GetResponse()<CR><LF> at OktaWidget.JwtService.GetStateTokenUsingJwt(String username)<CR><LF> at OktaWidget.OktaWidgetForm..ctor(String username, Int64 parent, Int64 widgetFlow)<CR><LF> at OktaWidget.OktaWidgetClass.displayWidget(Int64 parent, String username, Int64 flow)
Resolving the underlying cause, such as incorrect credentials, misconfigured installation parameters, or authorization issues, corrects the error.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Multi-Factor Authentication (MFA) Credential Provider
- Remote Desktop Protocol
Cause
The HTTP 401 (Unauthorized) status code indicates that the request lacks valid authentication credentials for the target resource. Known causes for this error appearing in the OktaWidget.log include:
- Incorrect username or password
- Incorrectly entered configuration option (CLIENT_ID, CLIENT_SECRET, or OKTA_URL)
- Trailing slash included in the URL during installation
- User not authorized to RDP to the server
- Duplicate users
- Skewed time or date
Solution
Correcting an Incorrect Username or Password
Ensure the username and password entered are completely accurate.
How Are Incorrect Configuration Options Resolved During Installation?
The values for CLIENT_ID, CLIENT_SECRET, and OKTA_URL can be located and corrected using the steps below. For details on locating the configuration file and understanding each parameter, see How To Locate and Modify The Okta MFA Credential Provider for Windows Agent Configuration File.
Navigate to the Microsoft RDP (MFA) application in Okta:
- In the Okta Admin Console, go to Applications > Applications.
- Select the Microsoft RDP (MFA) app.
Locate or update each parameter:
-
CLIENT_ID: Find this value on the General tab of the Microsoft RDP (MFA) application. This value can also be manually edited in the RDP agent configuration file. See How To Locate and Modify The Okta MFA Credential Provider for Windows Agent Configuration File for details.
-
CLIENT_SECRET: Find this value on the General tab of the Microsoft RDP (MFA) application. If the client secret is reset, reinstall the agent because the secret is encrypted in the agent configuration file. This value can also be manually edited in the RDP agent configuration file. See How To Locate and Modify The Okta MFA Credential Provider for Windows Agent Configuration File for details.
-
OKTA_URL: The org URL must use the format
https://org_name.okta.com— do not include a trailing slash. For example:https://oktalab.okta.com/— Incorrecthttps://oktalab.okta.com— Correct
See How To Locate and Modify The Okta MFA Credential Provider for Windows Agent Configuration File for details on locating the configuration file to modify this parameter.
NOTE: When copying the CLIENT_ID or CLIENT_SECRET from a Mac or Linux system into a Windows RDP or Console session, copy and paste can introduce errant characters. To avoid this, open the Okta Admin Console directly from the Windows server and copy the values from within that session. Alternatively, paste into Notepad first, then copy from Notepad into the installer or configuration file.
Verifying User Authorization to RDP to the Server
Confirm that Allow remote connections to this computer and Allow connections only from computers running Remote Desktop with Network Level Authentication are enabled in the System Properties dialog.
Confirm the user, or a group the user belongs to, is assigned in Remote Desktop Users, found under the Select Users button.
Also confirm the user is assigned to the Microsoft RDP (MFA) app in Okta.
Identifying and Removing Duplicate Users in Okta
Duplicate users can occur when the same username from multiple domains is imported into Okta. Search for the username in the Okta Admin Console under Directory > People to check for duplicates.
If more than one entry exists for the same username, this configuration is unsupported. Examine both entries and remove the duplicate.
Correcting a Skewed Time or Date on the Windows Server
The Windows Server system time must be accurate. Ensure Network Time Protocol (NTP) is configured and in sync, or manually adjust the time to the correct value.
