Auth0 Angular SDK Update Error: "Unable to issue redirect for OAuth 2.0 transaction"
Last Updated:
Overview
An application that was built using @auth/auth-angular version 1.11.1 was recently updated to use the latest version of the SDK (version 2.x.x). After upgrading the @auth0/angular dependency in the application, it appeared to successfully complete the first phase of authentication, using either the Auth0 database or social providers; however, the overall transaction failed to complete. This occurs because the configuration lacks the explicitly specified redirect URI or incorrectly defines the authorizationParams. Explicitly specifying the redirect URI within the authorizationParams resolves the issue.
When this failure occurs, the following error is generated:
server_error : Unable to issue redirect for OAuth 2.0 transaction
This failure mode also seems to generate a TIMEOUT error when trying to silently get an access token.
Applies To
- Auth0
- Angular Software Development Kit (SDK)
@auth0/angularversion 2.x.x
Cause
The failure occurs due to missing or incorrect configuration items. When configuring the Auth0 client, administrators must explicitly specify the redirect URI, which was not required in older versions. Additionally, the authorizationParams may be absent or incorrectly defined.
Solution
How is the Angular SDK update error resolved?
Resolve the error by explicitly specifying the redirect URI within the authorizationParams in the Auth0 client configuration. Review the Migration Guide, paying special attention to the section on authorizationParams.
Here is some sample code that illustrates this issue. Note the requirement to specify the redirect URI to prevent the error.
AuthModule.forRoot({
cacheLocation: "localstorage",
clientId: AG_OIDC_CLIENT_ID,
domain: AG_OIDC_DOMAIN,
httpInterceptor: {
allowedList: [httpInterceptorPath],
},
useRefreshTokens: true,
authorizationParams: {
audience: AG_OIDC_AUDIENCE,
redirect_uri:your_redirect_uri
},
}),