Failed to authenticate user using OAuth2/Open ID Connect. System.ArgumentException: Invalid JSON primitive: .

Hello All, 

We're trying to connect One Identity Manger with Keycloak using openID Connect protocol. Once we enter the URL of the Web portal it redirects back to AM for authentication, after authentication it redirect back to the web portal but with the below error:

Failed to authenticate user.
Invalid JSON primitive: .

Searching in the logs the error is below:

Failed to authenticate user using OAuth2/Open ID Connect. System.ArgumentException: Invalid JSON primitive: .
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)
at QER.OAuthAuthentifier.OAuth.<_GetTokenAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at QER.OAuthAuthentifier.OAuth.<GetClaimsAsync>d__30.MoveNext()

The version of 1IM is 8.2.

Can someone please advise if I am doing anything wrong.

Best regards.