npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dipakparmar/salesforce-auth-expo

v0.0.1-alpha4

Published

A React Native authentication library for Salesforce OAuth 2.0 with PKCE support, built specifically for Expo applications.

Readme

Salesforce Auth for Expo React Native

A React Native authentication library for Salesforce OAuth 2.0 with PKCE support, built specifically for Expo applications.

Features

  • OAuth 2.0 authentication with PKCE
  • Secure token storage
  • TypeScript support
  • Platform-specific storage handling (web/mobile)
  • Built-in hooks and context providers
  • User information retrieval
  • Salesforce REST API client

Installation

npm install @dipakparmar/salesforce-auth-expo

# or with yarn
yarn add @dipakparmar/salesforce-auth-expo

# or with pnpm
pnpm add @dipakparmar/salesforce-auth-expo

Dependencies

This package requires the following peer dependencies, you need to install them manually on your project:

npm install @react-native-async-storage/async-storage expo-auth-session expo-crypto expo-secure-store expo-web-browser react-native
{
  "@react-native-async-storage/async-storage": "^2.1.0",
  "expo-auth-session": "^6.0.0",
  "expo-crypto": "^14.0.1",
  "expo-secure-store": "^14.0.0",
  "expo-web-browser": "^14.0.1",
  "react-native": ">=0.76.3 <1"
}

Usage

  1. Wrap your app with SalesforceAuthProvider:
import { SalesforceAuthProvider, type SalesforceConfig, type GeneralAuthConfig } from "@dipakparmar/salesforce-auth-expo";

const config: SalesforceConfig & GeneralAuthConfig = {
  clientId: "YOUR_SALESFORCE_CLIENT_ID",
  clientSecret: "YOUR_SALESFORCE_CLIENT_SECRET", // Optional: Only needed for web platforms
  redirectUri: "myapp://callback", // Optional: Defaults to myapp://
  sandbox: false, // Optional: Set to true for sandbox environment
};

export default function App() {
  return (
    <SalesforceAuthProvider config={config}>
      <YourApp />
    </SalesforceAuthProvider>
  );
}
  1. Use the auth hook in your components:
import { useSalesforceAuth } from "@dipakparmar/salesforce-auth-expo";

function AuthComponent() {
  const { isAuthenticated, isInitialized, signIn, signOut, getUserInfo } =
    useSalesforceAuth();

  const handleLogin = async () => {
    try {
      await signIn();
      const userInfo = await getUserInfo();
      console.log("User info:", userInfo);
    } catch (error) {
      console.error("Auth error:", error);
    }
  };

  if (!isInitialized) {
    return <Text>Loading...</Text>;
  }

  return (
    <View>
      {isAuthenticated ? (
        <Button title="Sign Out" onPress={signOut} />
      ) : (
        <Button title="Sign In" onPress={handleLogin} />
      )}
    </View>
  );
}

REST API Usage

The library provides a REST API client for interacting with Salesforce data. Access it using the getRestClient() method from the auth hook:

import { useSalesforceAuth } from "@dipakparmar/salesforce-auth-expo";

function SalesforceDataComponent() {
  const { getRestClient } = useSalesforceAuth();

  const fetchAccounts = async () => {
    try {
      const client = await getRestClient();
      
      // Query records
      const result = await client.query<Account>('SELECT Id, Name FROM Account LIMIT 10');
      console.log('Accounts:', result.records);
      
      // Create a record
      const newAccount = await client.create<Account>('Account', {
        Name: 'New Account'
      });
      
      // Update a record
      await client.update<Account>('Account', newAccount.id, {
        Name: 'Updated Account'
      });
      
      // Delete a record
      await client.delete('Account', newAccount.id);
      
      // Retrieve a single record
      const account = await client.retrieve<Account>('Account', newAccount.id, ['Name', 'Industry']);
      
      // Get object metadata
      const metadata = await client.describe<AccountMetadata>('Account');
      
    } catch (error) {
      console.error('API error:', error);
    }
  };

  return (
    <Button title="Fetch Accounts" onPress={fetchAccounts} />
  );
}

interface Account {
  Id: string;
  Name: string;
  Industry?: string;
}

License

MIT

Credits

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.