Skip to content

Commit a59f2c2

Browse files
committed
Updates
2 parents af879ce + 881b268 commit a59f2c2

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

README.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ manager.configure({
2929
});
3030

3131
// ...
32-
manager.authorize('google', {scopes: 'profile,email'})
32+
manager.authorize('google', {scopes: 'profile email'})
3333
.then(resp => console.log('Your users ID'))
3434
.catch(err => console.log('There was an error'));
3535
```
@@ -96,7 +96,7 @@ Once you have linked this library, run the following command in the root directo
9696
(cd ios && pod install)
9797
```
9898

99-
Open the created `.xcworkspace` in the `ios/` directory (**NOT THE `.xproj` file**) when it's complete.
99+
Open in xcode the created `.xcworkspace` in the `ios/` directory (**NOT THE `.xproj` file**) when it's complete.
100100

101101
When working on iOS 10, we'll need to enable _Keychain Sharing Entitlement_ in _Capabilities_ of the build target of `io.fullstack.oauth.AUTH_MANAGER`.
102102

@@ -166,6 +166,33 @@ After we link `react-native-oauth` to our application, we're ready to go. Androi
166166

167167
One note, *all* of the callback urls follow the scheme: `http://localhost/[provider_name]`. Make sure this is set as a configuration for each provider below (documented in the provider setup sections).
168168

169+
Make sure you add the following to your `android/build.gradle` file:
170+
171+
```
172+
maven { url "https://jitpack.io" }
173+
```
174+
175+
For instance, an example `android/build.gradle` file would look like this:
176+
177+
```
178+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
179+
180+
buildscript {
181+
// ...
182+
}
183+
184+
allprojects {
185+
repositories {
186+
mavenLocal()
187+
jcenter()
188+
maven { url "https://jitpack.io" } // <~ ADD THIS LINE
189+
maven {
190+
url "$rootDir/../node_modules/react-native/android"
191+
}
192+
}
193+
}
194+
```
195+
169196
## Creating the manager
170197

171198
In our JS, we can create the manager by instantiating a new instance of it using the `new` method and passing it the name of our app:
@@ -220,6 +247,10 @@ Once you have created one, navigate to the application and find the `Keys and Ac
220247

221248
![](./resources/twitter/api-key.png)
222249

250+
For the authentication to work properly, you need to set the Callback URL. It doesn't matter what you choose as long as its a valid url.
251+
252+
![](./resources/twitter/callback-url.png)
253+
223254
Twitter's URL scheme needs to be the app name (that we pass into the constructor method). Make sure we have one registered in Xcode as the same name:
224255

225256
![](./resources/twitter/url-scheme.png)
@@ -253,9 +284,13 @@ For instance, my app ID in this example is: `1745641015707619`. In the `Bundle I
253284

254285
![](./resources/facebook/redirect-url.png)
255286

287+
For Android, you will also need to set the redirect url to `http://localhost/facebook` in the Facebook Login settings.
288+
289+
![](./resources/facebook/redirect-url.png)
290+
256291
We'll need to create a new URL scheme for Facebook and (this is a weird bug on the Facebook side) the facebook redirect URL scheme _must be the first one_ in the list. The URL scheme needs to be the same id as the `Bundle ID` copied from above:
257292

258-
![](./resources/facebook/url-scheme.png)
293+
![](./resources/facebook/facebook-redirect.png)
259294

260295
Back in our application, add the App ID and the secret as:
261296

ios/OAuthManager/OAuthManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#import <Foundation/Foundation.h>
99

1010
#import <React/RCTBridgeModule.h>
11-
#import "RCTLinkingManager.h"
11+
#import <React/RCTLinkingManager.h>
1212

1313
@class OAuthClient;
1414

109 KB
Loading

resources/twitter/callback-url.png

193 KB
Loading

0 commit comments

Comments
 (0)