You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-27Lines changed: 39 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ As we are integrating with react-native, we have a little more setup to integrat
57
57
58
58
#### RCTLinkingManager
59
59
60
-
Since `react-native-oauth` depends upon the `RCTLinkingManager` (from react-native core), we'll need to make sure we link this in our app.
60
+
Since `react-native-oauth` depends upon the `RCTLinkingManager` (from react-native core), we'll need to make sure we link this in our app.
61
61
62
62
In your app, add the following line to your `HEADER SEARCH PATHS`:
63
63
@@ -77,9 +77,9 @@ To automatically link our `react-native-oauth` client to our application, use th
77
77
react-native link react-native-oauth
78
78
```
79
79
80
-
Note: due to some restrictions on iOS, this module requires you to install cocoapods. The process has been semi-automated through using the above `react-native link` command.
80
+
Note: due to some restrictions on iOS, this module requires you to install cocoapods. The process has been semi-automated through using the above `react-native link` command.
81
81
82
-
Once you have linked this library, run the following command in the root directory:
82
+
Once you have linked this library, run the following command in the root directory:
83
83
84
84
```
85
85
(cd ios && pod install)
@@ -93,7 +93,7 @@ When working on iOS 10, we'll need to enable _Keychain Sharing Entitlement_ in _
93
93
94
94
### Android setup
95
95
96
-
We need to handle two steps in the installation process:
96
+
We need to handle two steps in the installation process:
97
97
98
98
* link `react-native-oauth` to our project (`react-native link react-native-oauth`)
99
99
* Add the `maven { url "https://jitpack.io" }` to our `android/build.gradle` file under `allProjects`. For example:
@@ -144,13 +144,13 @@ In addition, we'll need to set up the handlers within the iOS app. Add the follo
@@ -166,13 +166,13 @@ One note, *all* of the callback urls follow the scheme: `http://localhost/[provi
166
166
167
167
### Adding URL schemes
168
168
169
-
In order for our app to load through these callbacks, we need to tell our iOS app that we want to load them. In order to do that, we'll have to create some URL schemes to register our app. Some providers require specific schemes (mentioned later).
169
+
In order for our app to load through these callbacks, we need to tell our iOS app that we want to load them. In order to do that, we'll have to create some URL schemes to register our app. Some providers require specific schemes (mentioned later).
170
170
171
171
These URL schemes can be added by navigating to to the `info` panel of our app in Xcode (see screenshot).
172
172
173
173

174
174
175
-
Let's add the appropriate one for our provider. For instance, to set up twitter, add the app name as a URL scheme in the URL scheme box.
175
+
Let's add the appropriate one for our provider. For instance, to set up twitter, add the app name as a URL scheme in the URL scheme box.
176
176
177
177

178
178
@@ -222,7 +222,7 @@ The following list are the providers we've implemented thus far in `react-native
222
222
223
223
#### Twitter (iOS/Android)
224
224
225
-
To authenticate against twitter, we need to register a Twitter application. Register your twitter application (or create a new one at [apps.twitter.com](https://apps.twitter.com)).
225
+
To authenticate against twitter, we need to register a Twitter application. Register your twitter application (or create a new one at [apps.twitter.com](https://apps.twitter.com)).
226
226
227
227

228
228
@@ -247,7 +247,7 @@ const config = {
247
247
248
248
#### Facebook (iOS/Android)
249
249
250
-
To add facebook authentication, we'll need to have a Facebook app. To create one (or use an existing one), navigate to [developers.facebook.com/](https://developers.facebook.com/).
250
+
To add facebook authentication, we'll need to have a Facebook app. To create one (or use an existing one), navigate to [developers.facebook.com/](https://developers.facebook.com/).
251
251
252
252

253
253
@@ -259,7 +259,7 @@ Before we leave the Facebook settings, we need to tell Facebook we have a new re
259
259
260
260
`fb{YOUR_APP_ID}`
261
261
262
-
For instance, my app ID in this example is: `1745641015707619`. In the `Bundle ID` field, I have added `fb1745641015707619`.
262
+
For instance, my app ID in this example is: `1745641015707619`. In the `Bundle ID` field, I have added `fb1745641015707619`.
263
263
264
264

265
265
@@ -280,7 +280,7 @@ const config = {
280
280
281
281
#### Google (iOS)
282
282
283
-
To add Google auth to our application, first we'll need to create a google application. Create or use an existing one by heading to the [developers.google.com/](https://developers.google.com/) page (or the console directly at [https://console.developers.google.com](https://console.developers.google.com)).
283
+
To add Google auth to our application, first we'll need to create a google application. Create or use an existing one by heading to the [developers.google.com/](https://developers.google.com/) page (or the console directly at [https://console.developers.google.com](https://console.developers.google.com)).
284
284
285
285

286
286
@@ -311,7 +311,7 @@ To set up Google on Android, follow the same steps as before, except this time i
311
311
312
312

313
313
314
-
When creating an Android-specific configuration, create a file called `config/development.android.js`. React Native will load it instead of the `config/development.js` file automatically on Android.
314
+
When creating an Android-specific configuration, create a file called `config/development.android.js`. React Native will load it instead of the `config/development.js` file automatically on Android.
315
315
316
316
#### Github (iOS/Android)
317
317
@@ -339,7 +339,7 @@ const config = {
339
339
340
340
## Slack
341
341
342
-
We'll need to create an app first. Head to the slack developer docs at [https://slack.com/developers](https://slack.com/developers).
342
+
We'll need to create an app first. Head to the slack developer docs at [https://slack.com/developers](https://slack.com/developers).
343
343
344
344

345
345
@@ -362,7 +362,7 @@ const config = {
362
362
}
363
363
```
364
364
365
-
Lastly, Slack requires us to add a redirect_url.
365
+
Lastly, Slack requires us to add a redirect_url.
366
366
367
367
For **iOS**: the callback_url pattern is `${app_name}://oauth`, so make sure to add your redirect_url where it asks for them before starting to work with the API.
368
368
@@ -398,29 +398,29 @@ The `resp` object is set as follows:
398
398
authorized:true, (boolean)
399
399
uuid:"UUID", (user UUID)
400
400
credentials: {
401
-
access_token:"access token",
401
+
access_token:"access token",
402
402
refresh_token:"refresh token",
403
403
type:1
404
404
}
405
405
}
406
406
}
407
407
```
408
408
409
-
The second argument accepts an object where we can ask for additional scopes, override default values, etc.
409
+
The second argument accepts an object where we can ask for additional scopes, override default values, etc.
* Scopes are a list of scopes _comma separated_ as a string.
417
+
* Scopes are a list of scopes _comma separated_ as a string.
418
418
419
419
## Calling a provider's API
420
420
421
421
We can use OAuthManager to make requests to endpoints from our providers as well. For instance, let's say we want to get a user's time line from twitter. We would make the request to the url [https://api.twitter.com/1.1/statuses/user_timeline.json](https://api.twitter.com/1.1/statuses/user_timeline.json)
422
422
423
-
If our user has been authorized for thi request, we can execute the request using the credentials stored by the OAuthManager.
423
+
If our user has been authorized for thi request, we can execute the request using the credentials stored by the OAuthManager.
424
424
425
425
The `makeRequest()` method accepts 3 parameters:
426
426
@@ -431,7 +431,7 @@ The `makeRequest()` method accepts 3 parameters:
431
431
We can pass a list of options for our request with the last argument. The keys OAuthManager recognizes are:
432
432
433
433
1.`params` - The query parameters
434
-
2.`method` - The http method to make the request with.
434
+
2.`method` - The http method to make the request with.
0 commit comments