Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Add license
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
adamjmcgrath committed May 31, 2015
1 parent d1fca9a commit 92ca20c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 2 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013-2014 Byliner, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
80 changes: 78 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,87 @@
# react-native-simple-auth
[SimpleAuth iOS](https://github.com/calebd/SimpleAuth) wrapper for React Native [WIP]
## [SimpleAuth iOS](https://github.com/calebd/SimpleAuth) wrapper for React Native

* [Screencast](#screencast)
* [Install](#install)
* [Usage](#usage)
* [License](#license)

Screencast
==========

![Screencast](https://raw.githubusercontent.com/adamjmcgrath/react-native-simple-auth/master/screencast.gif)

1. `npm install react-native-simple-auth --save`
Install
=======

1. `npm install react-native-simple-auth`
2. In XCode, in the project navigator right click `Libraries``Add Files to [your project's name]`
3. Go to `node_modules``react-native-simple-auth`➜ iOS and add `SimpleAuthWrapper.h` and `SimpleAuthWrapper.m`
4. Go to your project's root directory and add a Podfile similar to https://github.com/adamjmcgrath/react-native-simple-auth/blob/master/Podfile
5. Install CocoaPods https://guides.cocoapods.org/using/getting-started.html
6. Run `pod install`

Usage
=====

Create a configuration object for each of the providers you want to authorize with (required keys are in parenthesis):

- google-web (`client_id`, `client_secret`)
- facebook (`app_id`)
- twitter (`consumer_key`, `consumer_secret`)
- instagram (`client_id`, `redirect_uri`)
- tumblr (`consumer_key`, `consumer_secret`)
- linkedin-web (`client_id`, `client_secret`, `redirect_uri`)

See [secrets.example.js](blob/master/secrets.example.js).

[Other providers supported by SimpleAuth](https://github.com/calebd/SimpleAuth#simpleauth) may work, but haven't been tested.

Create an instance of the SimpleAuthWrapper library:

```javascript
let SimpleAuthClient = require('react-native-simple-aut');
let simpleAuthClient = new SimpleAuthClient();
```

Configure the library with a single provider:

```javascript
simpleAuthClient.configure('twitter', {
consumer_key: 'KEY',
consumer_secret: 'SECRET'
}).then(() => {
// Twitter is configured.
})```
Or multiple providers:
```javascript
simpleAuthClient.configure({
twitter: {
consumer_key: 'KEY',
consumer_secret: 'SECRET'
},
facebook: {
app_id: 'ID'
}
}).then(() => {
// Twitter & Facebook are configured.
});``

Then authorize each provider:

```javascript
simpleAuthClient.authorize('twitter').then((info) => {
let token = info.token;
let name = info.name;
}).catch((error) => {
let errorCode = error.code;
let errorDescription = error.description;
});``
License
=======
react-native-simple-auth is released under the MIT license.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "react-native-simple-auth",
"version": "0.0.2",
"description": "Native social authentication for React Native on iOS",
"main": "lib/simpleauthclient.js",
"scripts": {
"start": "node_modules/react-native/packager/packager.sh",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down

0 comments on commit 92ca20c

Please sign in to comment.