Skip to content

Commit

Permalink
Upgrade AppAuth-iOS to 1.0.0 (#338)
Browse files Browse the repository at this point in the history
* Upgrade AppAuth-iOS to 1.0.0

* Add AppAuth dependency in the root level Podspec

* Remove duplicate podspec

* Keep the root level podspec only

* Rename root level podspec to match library name

* Update pod install instructions
  • Loading branch information
Kadi Kraman committed Jun 28, 2019
1 parent 1379494 commit f160144
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 65 deletions.
57 changes: 20 additions & 37 deletions README.md
Expand Up @@ -183,41 +183,8 @@ const result = await revoke(config, {

```sh
npm install react-native-app-auth --save
react-native link react-native-app-auth
```

**Then follow the [Setup](#setup) steps to configure the native iOS and Android projects.**

If you are not using `react-native link`, perform the [Manual installation](#manual-installation)
steps instead.

### Manual installation

#### iOS

1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
2. Go to `node_modules``react-native-app-auth` and add `RNAppAuth.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNAppAuth.a` to your project's
`Build Phases``Link Binary With Libraries`
4. Run your project (`Cmd+R`)<

#### Android

1. Open up `android/app/src/main/java/[...]/MainApplication.java`

* Add `import com.rnappauth.RNAppAuthPackage;` to the imports at the top of the file
* Add `new RNAppAuthPackage()` to the list returned by the `getPackages()` method

2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-app-auth'
project(':react-native-app-auth').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-app-auth/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-app-auth')
```

## Setup

### iOS Setup
Expand All @@ -238,12 +205,28 @@ AppAuth supports three options for dependency management.

1. **CocoaPods**

With [CocoaPods](https://guides.cocoapods.org/using/getting-started.html), add the following line to
your `Podfile`:
**RN<0.60**:

```sh
react-native link react-native-app-auth
```

With [CocoaPods](https://guides.cocoapods.org/using/getting-started.html), add the following line to
your `Podfile`:

```sh
pod 'AppAuth', '>= 0.94'
```

Then run `pod install`.

pod 'AppAuth', '>= 0.94'
**RN>=0.60**:
With React Native 0.60 and later, linking of pods is done automatically

Then run `pod install`. Note that version 0.94 is the first of the library to support iOS 11.
```sh
cd ios
pod install
```

2. **Carthage**

Expand Down
4 changes: 2 additions & 2 deletions ios/RNAppAuth.m
Expand Up @@ -159,8 +159,8 @@ + (nullable NSString *)codeChallengeS256ForVerifier:(NSString *)codeVerifier {
// generates the code_challenge per spec https://tools.ietf.org/html/rfc7636#section-4.2
// code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))
// NB. the ASCII conversion on the code_verifier entropy was done at time of generation.
NSData *sha265Verifier = [OIDTokenUtilities sha265:codeVerifier];
return [OIDTokenUtilities encodeBase64urlNoPadding:sha265Verifier];
NSData *sha256Verifier = [OIDTokenUtilities sha256:codeVerifier];
return [OIDTokenUtilities encodeBase64urlNoPadding:sha256Verifier];
}

/*
Expand Down
20 changes: 0 additions & 20 deletions ios/RNAppAuth.podspec

This file was deleted.

11 changes: 5 additions & 6 deletions react-native-app-auth.podspec
Expand Up @@ -7,13 +7,12 @@ Pod::Spec.new do |s|
s.version = package['version']
s.summary = package['description']
s.license = package['license']

s.authors = package['author']
s.homepage = package['homepage']
s.platform = :ios, "9.0"

s.source = { :git => "https://github.com/FormidableLabs/react-native-app-auth.git" }
s.source_files = "ios/**/*.{h,m}"

s.platform = :ios, '9.0'
s.source = { :git => 'https://github.com/FormidableLabs/react-native-app-auth.git' }
s.source_files = 'ios/**/*.{h,m}'
s.requires_arc = true
s.dependency 'React'
s.dependency 'AppAuth', '1.0.0'
end

0 comments on commit f160144

Please sign in to comment.