We have a reactjs web app where we configured new universal login and added support for email/password, google sso and salesforce sso logins.
This app is loaded as an iframe in salesforce. When a user wants to use our app in salesforce, here is the flow:
- Open salesforce and login.
- Open our app in a tab inside salesforce.
- Perform salesforce sso login again in our app.
- Use our app.
Instead of performing login twice, is it possible to reuse the login performed in salesforce directly?
Current code:
const App = () => {
const {isLoading, isAuthenticated, loginWithRedirect} = useAuth0();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
// check if salesforce login has already happened
// if so, skip loginWithRedirect and reuse existing login
loginWithRedirect();
}
}, [isLoading, isAuthenticated])
}