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
Display the source diff
Display the rich diff
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
@@ -80,9 +80,9 @@ To automatically link our `react-native-oauth` client to our application, use th
80
80
react-native link react-native-oauth
81
81
```
82
82
83
-
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.
83
+
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.
84
84
85
-
Once you have linked this library, run the following command in the root directory:
85
+
Once you have linked this library, run the following command in the root directory:
86
86
87
87
```
88
88
(cd ios && pod install)
@@ -96,7 +96,7 @@ When working on iOS 10, we'll need to enable _Keychain Sharing Entitlement_ in _
96
96
97
97
### Android setup
98
98
99
-
We need to handle two steps in the installation process:
99
+
We need to handle two steps in the installation process:
100
100
101
101
* link `react-native-oauth` to our project (`react-native link react-native-oauth`)
102
102
* Add the `maven { url "https://jitpack.io" }` to our `android/build.gradle` file under `allProjects`. For example:
@@ -147,13 +147,13 @@ In addition, we'll need to set up the handlers within the iOS app. Add the follo
@@ -169,13 +169,13 @@ One note, *all* of the callback urls follow the scheme: `http://localhost/[provi
169
169
170
170
### Adding URL schemes
171
171
172
-
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).
172
+
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).
173
173
174
174
These URL schemes can be added by navigating to to the `info` panel of our app in Xcode (see screenshot).
175
175
176
176

177
177
178
-
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.
178
+
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.
179
179
180
180

181
181
@@ -225,7 +225,7 @@ The following list are the providers we've implemented thus far in `react-native
225
225
226
226
#### Twitter (iOS/Android)
227
227
228
-
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)).
228
+
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)).
229
229
230
230

231
231
@@ -250,7 +250,7 @@ const config = {
250
250
251
251
#### Facebook (iOS/Android)
252
252
253
-
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/).
253
+
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/).
254
254
255
255

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

268
268
@@ -283,7 +283,7 @@ const config = {
283
283
284
284
#### Google (iOS)
285
285
286
-
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)).
286
+
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)).
287
287
288
288

289
289
@@ -314,7 +314,7 @@ To set up Google on Android, follow the same steps as before, except this time i
314
314
315
315

316
316
317
-
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.
317
+
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.
318
318
319
319
#### Github (iOS/Android)
320
320
@@ -342,7 +342,7 @@ const config = {
342
342
343
343
## Slack
344
344
345
-
We'll need to create an app first. Head to the slack developer docs at [https://slack.com/developers](https://slack.com/developers).
345
+
We'll need to create an app first. Head to the slack developer docs at [https://slack.com/developers](https://slack.com/developers).
346
346
347
347

348
348
@@ -365,7 +365,7 @@ const config = {
365
365
}
366
366
```
367
367
368
-
Lastly, Slack requires us to add a redirect_url.
368
+
Lastly, Slack requires us to add a redirect_url.
369
369
370
370
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.
371
371
@@ -401,29 +401,29 @@ The `resp` object is set as follows:
401
401
authorized:true, (boolean)
402
402
uuid:"UUID", (user UUID)
403
403
credentials: {
404
-
access_token:"access token",
404
+
access_token:"access token",
405
405
refresh_token:"refresh token",
406
406
type:1
407
407
}
408
408
}
409
409
}
410
410
```
411
411
412
-
The second argument accepts an object where we can ask for additional scopes, override default values, etc.
412
+
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.
420
+
* Scopes are a list of scopes _comma separated_ as a string.
421
421
422
422
## Calling a provider's API
423
423
424
424
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)
425
425
426
-
If our user has been authorized for thi request, we can execute the request using the credentials stored by the OAuthManager.
426
+
If our user has been authorized for thi request, we can execute the request using the credentials stored by the OAuthManager.
427
427
428
428
The `makeRequest()` method accepts 3 parameters:
429
429
@@ -434,7 +434,7 @@ The `makeRequest()` method accepts 3 parameters:
434
434
We can pass a list of options for our request with the last argument. The keys OAuthManager recognizes are:
435
435
436
436
1.`params` - The query parameters
437
-
2.`method` - The http method to make the request with.
437
+
2.`method` - The http method to make the request with.
0 commit comments