My website has 2 points of user login: one is through my app and the other is via a link on a third-party site. If a user comes from the third-party site, they should be redirected back to it.
The only method I can come up with to distinguish if a user is coming from a third party is by adding a query parameter to the sign-in link.
For instance, the third party will provide a link like:
https://myapp.com/signin?comingFrom3rdParty=true
I aim to utilize this query parameter in the signIn callback function to determine the next step after successful login:
if(comingFrom3rdParty) {
// redirect back to the third party
} else {
// redirect to my website's dashboard
}
I'm unsure if using query parameters is the right approach for this situation, but I cannot think of an alternate solution at the moment.