Posts

Showing posts with the label Community Users

Migrate Community Users Between Licenses

Here are some of the links to help you with your License transformation process. You can move community users between certain licenses using Data Loader Mass change User License Type Experience Cloud Licenses Eligible for Upgrades - Help And Training Community Migrate Community Users Between Licenses ( https://help.salesforce.com/articleView?id=networks_migrate_users_between_licenses.htm&type=5 ). Upgrade Community User Licenses ( Help And Training Community ).  Mass disable portal users with Data Loader - https://help.salesforce.com/s/articleView?id=000386423&type=1

Authenticating Using Salesforce Community User

Scenario - Sometimes we want to authorize servers to access data without interactively logging in each time the servers exchange information. For these cases, we can use the OAuth 2.0 JSON Web Token (JWT) bearer flow. This flow uses a certificate to sign the JWT request and doesn’t require explicit user interaction. However, this flow does require prior approval of the client app. Profiles will need to be pre-authorized with the connected app. There was also a requirement to make a rest call to get Salesforce data using Salesforce Community User Context. Option 1: Authenticate using the SOAP login request Option 2: OAuth 2.0 JWT Bearer Flow for Server-to-Server Integration

Retrieve IP Address of a Community User

Image
For a variety of purposes, including displaying items, sending texts, and other security-related tasks, tracing IP addresses is necessary. Logged in User IP Address Getting IP Address for logged in user is relatively simple as Salesforce stores this information in two standard objects:  AuthSession ,  LoginGeo . List<AuthSession> auth = [SELECT Id , IsCurrent, SessionType, CreatedDate, LoginGeoId, NumSecondsValid FROM AuthSession WHERE UsersId =: Userinfo.getUserID()]; if(auth.isEmpty() == false && auth[0].IsCurrent ){ system.debug('yes, it is current user session'); }else{ system.debug('No, it is not current user session'); } List<LoginGeo> lg = [SELECT Id,City, Country, PostalCode, Subdivision, Latitude, Longitude,LoginTime FROM LoginGeo WHERE Id =: auth[0].LoginGeoId]; Alternatively, you can use  Auth.SessionManagement  Class as well as below: Auth.SessionManagement.getCurrentSession().get('LoginGeoId'); getCurrentSession() re...