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
+34-3Lines changed: 34 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -172,17 +172,48 @@ We can use an external authentication provider, such as twitter/facebook for aut
172
172
173
173
> By using a separate library, we can keep our dependencies a little lower and the size of the application down.
174
174
175
+
### OAuth setup with library
176
+
175
177
We'll use the [react-native-oauth](https://github.com/fullstackreact/react-native-oauth) library, which was built along-side [Firestack](https://github.com/fullstackreact/react-native-firestack) specifically to handle authentication through third-party providers.
176
178
177
179
> If you prefer to use another library, make sure you pass through the `oauthToken` and `oauthTokenSecret` provided by your other library to call the `signInWithProvider()` method.
178
180
179
-
Following the instructions at
181
+
Following the instructions on the [react-native-oauth README](https://github.com/fullstackreact/react-native-oauth), we'll need to install it using `npm`:
182
+
183
+
```javascript
184
+
npm install --save react-native-oauth
185
+
```
186
+
187
+
It's important to set up the authentication library fully with our app configuration. Make sure to configure your app [along with this step](https://github.com/fullstackreact/react-native-oauth#handle-deep-linking-loading) otherwise authentication _cannot_ work.
188
+
189
+
Once the app is configured with the instructions, we can call the `oauthManager`'s (or other library's) login method. We'll need to hold on to the `oauthToken` and an `oauthTokenSecret` provided by the provider. Using these values, we can call the `signInWithProvider()` method. The `signInWithProvider()` method accepts three parameters:
190
+
191
+
1. The provider (such as `twitter`, `facebook`, etc) name
192
+
2. The `authToken` value granted by the provider
193
+
3. The `authTokenSecret` value granted by the provider
194
+
195
+
```javascript
196
+
// For instance, using the react-native-oauth library, this process
If the `signInWithProvider()` method resolves correct and we have already set up our `listenForAuth()` method properly, it will fire and we'll have a logged in user through Firebase.
182
213
183
214
### reauthenticateWithCredentialForProvider()
184
215
185
-
...
216
+
When the auth token has expired, we can ask firebase to reauthenticate with the provider. This method accepts the _same_ arguments as `signInWithProvider()` accepts.
0 commit comments