Skip to content

hennessyevan/expo-user-identity

Repository files navigation

Expo User Identity

This Expo module provides an async function for Expo apps running on both iOS and Android. It returns an iCloud user identity on iOS and an email on Android. It automatically sets appropriate entitlements for iOS.

Installation

To install this module, run the following command:

npx expo install expo-user-identity

Configuration

This module also includes a plugin configuration. For iCloud, the default container environment is set to "Development" but when you push your iCloud container to "Production", you need to set that in your plugins config:

    "plugins": [
      [
        "expo-user-identity",
        {          
          "iCloudContainerEnvironment": "Production"
        }
      ]
    ]

Add the following lines to your app.json/app.config.js file to enable the CloudKit capabilities automatically:

    ...,
    "ios": {
      ...
      "entitlements": {
        "com.apple.developer.icloud-services": ["CloudKit"]
      },
    },
    ...

Usage

This module only has one method, getUserIdentity(), which returns a promise that resolves to a string.

import { getUserIdentity } from 'expo-user-identity'

Roadmap

  • iOS support
  • Android support
  • Web support (if possible, likely not)