Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Unauthenticated REST Requests
In certain cases, some applications must make REST calls before the user becomes authenticated. In other cases, the application must access services outside of Salesforce that don’t require Salesforce authentication. To implement such requirements, use a special RestClient instance that doesn’t require an authentication token.
To obtain an unauthenticated RestClient on Android, use one of the following ClientManager factory methods:
1/**
2* Method to create an unauthenticated RestClient asynchronously
3* @param activityContext
4* @param restClientCallback
5*/
6public void getUnauthenticatedRestClient(Activity activityContext, RestClientCallback restClientCallback);1/**
2* Method to create an unauthenticated RestClient.
3* @return
4*/
5public RestClient peekUnauthenticatedRestClient();Example
- Kotlin
-
1val unauthenticatedRestClient = clientManager.peekUnauthenticatedRestClient() 2val request = RestRequest(RestMethod.GET, 3 "https://api.spotify.com/v1/search?q=James%20Brown&type=artist", null) 4val response = unauthenticatedRestClient.sendSync(request) - Java
-
1RestClient unauthenticatedRestClient = clientManager.peekUnauthenticatedRestClient(); 2RestRequest request = new RestRequest(RestMethod.GET, 3 "https://api.spotify.com/v1/search?q=James%20Brown&type=artist", null); 4RestResponse response = unauthenticatedRestClient.sendSync(request);