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();

A REST request sent through either of these RestClient objects requires a full path URL. Mobile SDK doesn’t prepend an instance URL to unauthenticated endpoints.

Note

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);

We've Moved

Welcome to the new home of the Mobile SDK Developer Guide! For now, the Japanese guide can be found in PDF form.