Theme-my-Login is good for always redirecting to the same URL depending on the user role. I was thinking about something more flexible and spontaneous.
You would know where to redirect by remembering the initial URL called.
Examples:
https://wp-site.com/?wtlwp_token=0e17194f4463cc51730cb0fef7c44280 -> log in and redirect 302 -> https://wp-site.com/
https://wp-site.com/category/widgets/?wtlwp_token=0e17194f4463cc51730cb0fef7c44280 -> log in and redirect 302 -> https://wp-site.com/category/widgets/
https://wp-site.com/post-title?wtlwp_token=0e17194f4463cc51730cb0fef7c44280 -> log in and redirect 302 -> https://wp-site.com/post-title
https://wp-site.com/wp-admin/edit.php?wtlwp_token=0e17194f4463cc51730cb0fef7c44280 -> log in and redirect 302 -> https://wp-site.com/wp-admin/edit.php
In the plugin backend, you would only generate:
https://wp-site.com/wp-admin/?wtlwp_token=0e17194f4463cc51730cb0fef7c44280 -> log in and redirect 302 -> https://wp-site.com/wp-admin/
But you could put an info box explaining that it’s possible to append the token to other URLs in order to have the temporary user visit that particular page directly, with the privileges afforded by the chosen user role.