Embedded Login Failure with "AuthSdkError: Malformed Token" in Okta OIDC Applications
Last Updated:
Overview
Frontend OpenID Connect (OIDC) applications using embedded login via Sign In Widget or okta-auth-js fail after a user completes all authentication steps, producing an AuthSdkError: Malformed token error in the browser developer console. The Custom Authorization Server used by the application has Access Token Encryption enabled, which is incompatible with public frontend applications. Removing token encryption from the Authorization Server, or pointing the application to an Authorization Server without encryption enabled, resolves the issue.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Embedded Authentication
- Sign In Widget / okta-auth-js
- OIDC Applications
- JSON Web Encryption (JWE)
Cause
The Custom Authorization Server used by the application has Access Token Encryption enabled. Public frontend applications cannot securely store a private key, so Okta is unable to decrypt the token, producing the AuthSdkError: Malformed token error.
Solution
Removing Token Encryption from the Authorization Server
Remove token encryption from the Custom Authorization Server to restore embedded login functionality.
- Navigate to the Custom Authorization Server that the application uses.
- Disable Access Token Encryption on the Authorization Server.
NOTE: JSON Web Encryption (JWE) of either access_token or id_token is not intended for public frontend applications. It requires the client to securely store a private key, which public applications cannot do.
How is the Application Pointed to a Non-Encrypting Authorization Server?
Point the application to an Authorization Server that does not have encryption enabled as an alternative to disabling encryption on the existing server.
- Identify an Authorization Server in the Okta Admin Console that does not have Access Token Encryption enabled.
- Update the application configuration to reference that Authorization Server.
