Application unable to connect after doing a failover ,Mirroring After doing a failover to mirror database, the application is throwing below error 
Login failed for user 'NT Authority\anonymous logon'. reason: could not find a login matching the name provided

In error log it is logging
Login failed for user 'xxx'.Reason: failed to open the explicitly specified database ' xxx'. Error 18456,severity:14,state:38

I know this question is duplicated and i found many threads, but i don't find the solution in them or may be i'm unable to understand that.

Please help me with the steps to resolve.
How is your application connecting to the SQL Server?  

If it is not a direct connection and involve two hops(for example lets say you have an web tier that goes through an App tier and then to SQL Server) it might be related to kerberos authentication.

You can check if if the connection that were coming into the principle server for the application were NTLM or Kerberos.  Please check the below link

Using Kerberos Authentication with SQL Server

If it is, that means that your principle server was configured correctly to facilitate kerberos authentication and you would have to do the same thing for secondary server.

Register a Service Principal Name for Kerberos Connections

Another not so ideal situation could be that someone has added  NT Authority\anonymous as login on the primary server, you could technically make it work by adding the same thing to the secondary server, but it is not recommended.