$ npm install react-native-sf-authenticationSession --save
$ react-native link react-native-sf-authenticationSession
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-sf-authenticationSession
and addSFAuthentication.xcodeproj
- In XCode, in the project navigator, select your project. Add
libSFAuthentication.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
import SFAuthentication from 'react-native-sf-authenticationSession';
...
// The url you want to open with safari
const url = "http://my.webapp.com"
// The url your server will redirect you to
// hint - use a custom schema or universal link to immediatly get back to your app
const callbackUrl = "myapp://"
// The redirected url with query params containing private data
// ex - "myapp://token=mysecrettoken"
const finalUrl = await SFAuthentication.getSafariData();
or
SFAuthentication.getSafariData(url,callbackUrl).then(data=>{
},error =>{
})