@ReactMethod
  public void getAuthCredentials(
      ReadableMap args, Callback successCallback, Callback errorCallback) {
    ClientManager clientManager =
        new ClientManager(
            getReactApplicationContext(),
            SalesforceSDKManager.getInstance().getAccountType(),
            SalesforceSDKManager.getInstance().getLoginOptions(),
            SalesforceSDKManager.getInstance().shouldLogoutWhenTokenRevoked());
    RestClient client = clientManager.peekRestClient();

    RestClient.ClientInfo clientInfo = client.getClientInfo();
    try {
      JSONObject data = new JSONObject();
      data.put(ACCESS_TOKEN, client.getAuthToken());
      data.put(REFRESH_TOKEN, client.getRefreshToken());
      data.put(USER_ID, clientInfo.userId);
      data.put(ORG_ID, clientInfo.orgId);
      data.put(CLIENT_ID, clientInfo.clientId);
      data.put(LOGIN_URL, clientInfo.loginUrl.toString());
      data.put(IDENTITY_URL, clientInfo.identityUrl.toString());
      data.put(INSTANCE_URL, clientInfo.instanceUrl.toString());
      data.put(COMMUNITY_ID, clientInfo.communityId);
      data.put(COMMUNITY_URL, clientInfo.communityUrl);

      ReactBridgeHelper.invokeSuccess(successCallback, data);
    } catch (JSONException e) {
      Log.e("OauthReactBridge", "getAuthCredentials", e);
      errorCallback.invoke(e.toString());
    }
  }
 /** @return credentials as JSONObject */
 private static JSONObject getJSONCredentials(RestClient client) {
   ClientInfo clientInfo = client.getClientInfo();
   Map<String, String> data = new HashMap<String, String>();
   data.put(ACCESS_TOKEN, client.getAuthToken());
   data.put(REFRESH_TOKEN, client.getRefreshToken());
   data.put(USER_ID, clientInfo.userId);
   data.put(ORG_ID, clientInfo.orgId);
   data.put(CLIENT_ID, clientInfo.clientId);
   data.put(LOGIN_URL, clientInfo.loginUrl.toString());
   data.put(INSTANCE_URL, clientInfo.instanceUrl.toString());
   data.put(USER_AGENT, ForceApp.APP.getUserAgent());
   return new JSONObject(data);
 }