I am facing the same issue with Sitecore 9.1, in summary the issue is Sitecore not being able to handle long ticket in Core
database
Sitecore has a cleanup task that should take care of cleaning the tickets in the database but for some reason it is not performing, and if you could check your logs and see if you have something similar
ManagedPoolThread #2 12:04:16 INFO Job started:
Sitecore.Tasks.CleanupAuthenticationTicketsAgent ManagedPoolThread #2
12:04:16 INFO CleanupAuthenticationTicketsAgent: Number of expired
authentication tickets that have been removed: 0 ManagedPoolThread #2
12:04:16 INFO CleanupAuthenticationTicketsAgent: Total number of
authentication tickets to process: 0 ManagedPoolThread #2 12:04:16
INFO Job ended: Sitecore.Tasks.CleanupAuthenticationTicketsAgent
(units processed: )
OR
20892 10:35:42 ERROR String or binary data would be truncated. The
statement has been terminated. Exception: System.Exception Message:
String or binary data would be truncated. The statement has been
terminated. Source: Sitecore.Kernel at
Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteNonQuery()
at
Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass33_0.b__0()
at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action,
Action recover) at
Sitecore.Data.Properties.SqlPropertyStore.SetStringValueCore(String
prefixedName, String value) at
Sitecore.Data.Properties.PropertyStore.SetStringValue(String name,
String value) at
Sitecore.Web.Authentication.DefaultTicketManager.CreateTicket(String
userName, String startUrl, Boolean persist) at
Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.SignedIn.CreateTicket.Process(SignedInArgs
args) at (Object , Object )
Nested Exception
Exception: System.Data.DataException Message: Error executing SQL
command: INSERT INTO [Properties] ( [Key], [Value] ) VALUES ( @name,
@value )
I hope you are able to find similar entries, however, if that's not the case, please give a shot using the following command in your SQL against the Core
database as a workaround and please note this is going to kill ALL sessions connected to CM
DELETE FROM [yourCoreDatabase].[dbo].[Properties] WHERE [Key] LIKE '%CORE_SC_TICKET%'
I am currently working with Sitecore Support since it seems that was fixed on Sitecore 9.0.1 and Sitecore 9.0.2 but newer versions are still facing such issue.
References: https://viniciusdeschamps.com.br/error-an-error-occurred-after-logging-in-sitecore/
Message: Unable to create a user. Reason: DuplicateUserName Source: Sitecore.Owin.Authentication