apple login with many sub domains
# support-questions
v
One more question about Apple auth. Apple always redirects back to our API instead of client (in comparison to google, let's say). supertokens then redirects back to websiteDomain that it has in config. The problem is how to handle situation when user can login both on a1.example.com and a2.example.com? With google it logs in at a2.example.com and redirected back to it. With apple - it logs in at a2.example.com but get redirected to a1.example.com (because a1.example.com is a websiteDomain in API config)
r
hey @vyobukhov We are working on making this situation easier, but what you can do is to override the backend API for apple redirection in apis override, and implement your own redirection logic inspired by our sdk code (if you tell me which backend sdk you use, i can point you to the current impl). Second, you want to set a custom attribute to the state on the frontend which you can do by overriding the
generateStateToSendToOAuthProvider
function on the frontend and and generating your own state string containing the target domain (here is our implementation of generating a state: https://github.com/supertokens/supertokens-web-js/blob/master/lib/ts/recipe/thirdparty/recipeImplementation.ts#L243) Then in your backend override for for apple redirection, you can read this state and know where to send the user to.