1.1.3 • Published 3 years ago

react-native-sp-auth v1.1.3

Weekly downloads
40
License
Apache-2.0
Repository
github
Last release
3 years ago

react-native-sp-auth

Getting started

$ yarn add react-native-sp-auth

Mostly automatic installation

$ react-native link react-native-sp-auth

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-sp-auth and add RNSpAuth.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNSpAuth.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.fx.rnspauth.RNSpAuthPackage; to the imports at the top of the file
  • Add new RNSpAuthPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-sp-auth'
    project(':react-native-sp-auth').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-sp-auth/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-sp-auth')

Usage

import RNSharePointAuth from 'react-native-sp-auth';

const sp = new RNSharePointAuth('https://yoursite.sharepoint.com');
try {
  // trying to restore session
  const digest = await sp.renewDigest();
} catch (e) {
  // can't automatic restore the session, read token from Storage
  const token = await Storage.getItem('token');
  if (token) {
    await sp.setToken(token);
    try {
      const digest = await sp.renewDigest();
    } catch (e1) {
      // can't restore the session, re-login
      const { digest, token } = await sp.login('yourusername@yourdomain', 'yourpassword');
      // store token back to Storage
      await Storage.setItem('token', token);
    }
  }
}

// renew digest if expired
const newDigest = await sp.renewDigest();

// obtain digest for site collection
const digest4SiteCollection = await sp.renewDigest('/sites/o40');
1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago