Facing problem in accessing office 365 via Auth0 using custom javascript solution

There is Custom javascript application, we had login to our application via Auth0. Also setup SSO integration with Office 365.
When we directly login to office via portal.office.com, it redirects to Auth0 custom domain login page
Now on login to our application, it does not automatically sign in to office365 as there is single sign-on so it should login
and also we logout from our application, it doesnot logout from office365.
It always keeps sign in that is big problem