How To Prevent Users from Using Social Connections
Last Updated:
Overview
This article explains how to prevent users from logging in with a social connection.
Applies To
- Social Connections
Solution
Method 1:
Using a post-login Action, it is possible to deny authentication access for users who want to use social connections instead of other methods.
- Every user is differentiated by the connection they have signed up for.
- Every authentication method(connection) has a boolean value of
is_social. - This value will be true only if the user has been logged in via a social connection; otherwise, it will be false.
Here is an example of code that does not let users authenticate using a social connection.
exports.onExecutePostLogin = async (event, api) => {
if (event.user.identities[0].isSocial){
api.access.deny("Social connection not allowed")
}
};
Method 2:
To disable social connections, follow the instructions on how to Update Application Connections and toggle off the social connections.