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

react-native-amazon-login

v1.0.0

Published

Amazon Login module for React Native and Expo applications

Readme

react-native-amazon-login

Amazon Login module for React Native and Expo applications. Supports both iOS and Android.

Features

  • ✅ iOS Support (LoginWithAmazon SDK)
  • ✅ Android Support (Login with Amazon SDK)
  • ✅ Expo Config Plugin for easy setup
  • ✅ TypeScript support
  • ✅ Promise-based API
  • ✅ Event listeners for login/logout

Installation

npm install react-native-amazon-login

Configuration

1. Get Your Amazon API Keys

For iOS:

  1. Go to Amazon Developer Console
  2. Create a Security Profile
  3. Add iOS Settings with your bundle identifier
  4. Copy the API Key (JWT token)

For Android:

  1. Go to Amazon Developer Console
  2. Add Android Settings
  3. Register your package name and app signature
  4. Copy the API Key

2. Add the Expo Config Plugin

In your app.json:

{
  "expo": {
    "plugins": [
      [
        "react-native-amazon-login",
        {
          "amazonApiKey": "YOUR_AMAZON_API_KEY"
        }
      ]
    ]
  }
}

3. Platform-Specific Setup

iOS Setup

The iOS SDK is included in the package. No additional steps needed!

Android Setup

  1. Download the Amazon Login SDK from Amazon Developer Portal
  2. Copy login-with-amazon-sdk.aar to node_modules/react-native-amazon-login/android/libs/

See ANDROID_INSTALLATION.md for detailed instructions.

4. Prebuild and Run

npx expo prebuild --clean
npx expo run:ios
npx expo run:android

Usage

Basic Login/Logout

import {
  login,
  logout,
  isLoggedIn,
  getUserProfile,
} from "react-native-amazon-login";

// Login
const handleLogin = async () => {
  try {
    const userProfile = await login();
    console.log("User:", userProfile);
    // { userId, name, email, postalCode, accessToken }
  } catch (error) {
    console.error("Login failed:", error);
  }
};

// Logout
const handleLogout = async () => {
  try {
    await logout();
    console.log("Logged out");
  } catch (error) {
    console.error("Logout failed:", error);
  }
};

// Check login status
const loggedIn = isLoggedIn();

// Get user profile
const profile = await getUserProfile();

Event Listeners

import {
  addLoginSuccessListener,
  addLoginFailureListener,
  addLogoutListener,
} from "react-native-amazon-login";

// Listen for login success
const successSubscription = addLoginSuccessListener((userData) => {
  console.log("Login successful:", userData);
});

// Listen for login failure
const failureSubscription = addLoginFailureListener((error) => {
  console.error("Login failed:", error);
});

// Listen for logout
const logoutSubscription = addLogoutListener(() => {
  console.log("User logged out");
});

// Clean up
successSubscription.remove();
failureSubscription.remove();
logoutSubscription.remove();

Complete Example

import React, { useEffect, useState } from 'react';
import { View, Button, Text } from 'react-native';
import {
  login,
  logout,
  addLoginSuccessListener,
  addLoginFailureListener
} from 'react-native-amazon-login';

export default function App() {
  const [user, setUser] = useState(null);

  useEffect(() => {
    const successSub = addLoginSuccessListener((userData) => {
      setUser(userData);
    });

    const failureSub = addLoginFailureListener((error) => {
      console.error('Login error:', error);
    });

    return () => {
      successSub.remove();
      failureSub.remove();
    };
  }, []);

  const handleLogin = async () => {
    try {
      const userData = await login();
      setUser(userData);
    } catch (error) {
      console.error('Login failed:', error);
    }
  };

  const handleLogout = async () => {
    try {
      await logout();
      setUser(null);
    } catch (error) {
      console.error('Logout failed:', error);
    }
  };

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      {user ? (
        <>
          <Text>Welcome, {user.name || user.email}!</Text>
          <Button title="Logout" onPress={handleLogout} />
        </>
      ) : (
        <Button title="Login with Amazon" onPress={handleLogin} />
      )}
    </View>
  );
}

API Reference

Methods

login(): Promise<AmazonUserProfile>

Initiates the Amazon login flow.

Returns: Promise that resolves with user profile data.

const user = await login();
// { userId, name, email, postalCode, accessToken }

logout(): Promise<void>

Signs out the current user.

await logout();

isLoggedIn(): boolean

Checks if a user is currently logged in.

const loggedIn = isLoggedIn();

getUserProfile(): Promise<AmazonUserProfile>

Fetches the current user's profile.

const profile = await getUserProfile();

Event Listeners

addLoginSuccessListener(callback)

Listens for successful login events.

addLoginFailureListener(callback)

Listens for login failure events.

addLogoutListener(callback)

Listens for logout events.

Types

interface AmazonUserProfile {
  userId: string;
  name?: string;
  email?: string;
  postalCode?: string;
  accessToken?: string;
}

interface LoginFailureEventPayload {
  type: string;
  error: string;
  userDidCancel: boolean;
  code?: string;
  domain?: string;
}

Troubleshooting

iOS Issues

"LoginWithAmazon not found"

  • Run npx expo prebuild --clean
  • Check that the plugin is configured in app.json

"Invalid API Key"

  • Verify your API key in Amazon Developer Console
  • Check that your bundle identifier matches

Android Issues

"SDK not found"

"Invalid API Key"

  • Verify your package name matches
  • Check that your app signature is registered
  • Make sure you're using the correct keystore

General Issues

"Plugin not found"

  • Run npm install to ensure the package is installed
  • Run npx expo prebuild --clean to regenerate native code

Documentation

Requirements

  • Expo SDK 50+
  • iOS 15.1+
  • Android API 24+
  • React Native 0.70+

License

MIT

Author

samsonroy [email protected]

Links