You want to take a look at this module: https://marketplace.mendix.com/link/component/107925
This gives you an idear on how to do the autologin. In the deeplink make sure you have something where you can identify which account it is. With that parameter create the autologin request and do the autologin.
Todo the rest of the deeplink is a bit tricky. You might need another deeplink for that. So retrieve the user, create another deeplink so that this user has a pending link and then do the autologin part so that this deeplinks get’s triggered.
Maybe the SAML module will be of use here? https://docs.mendix.com/appstore/modules/saml
You can use it together with the deep link module: https://docs.mendix.com/appstore/modules/deep-link
I hope this helps.
have a look at the password forget module from Mendix. There is an action that logges in the user.