Skip to content

Commit d1843a2

Browse files
committed
ExampleApp ios working
1 parent 038cc6a commit d1843a2

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

ExampleApp/index.ios.js

+39-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import {
99
AppRegistry,
1010
StyleSheet,
1111
Text,
12-
View
12+
View,
13+
TouchableHighlight
1314
} from 'react-native';
15+
import LinkedInSDK from 'react-native-linkedin-sdk';
1416

1517
export default class ExampleApp extends Component {
1618
render() {
@@ -26,6 +28,42 @@ export default class ExampleApp extends Component {
2628
Press Cmd+R to reload,{'\n'}
2729
Cmd+D or shake for dev menu
2830
</Text>
31+
<TouchableHighlight onPress={async () => {
32+
const token = await LinkedInSDK.signIn({
33+
// https://developer.linkedin.com/docs/oauth2
34+
35+
// iOS (Required)
36+
// The "API Key" value generated when you registered your application.
37+
clientID: '86ltc4i0wckzvo',
38+
39+
// iOS (Required)
40+
clientSecret: 'KCPHGyyXOjmGy72S',
41+
42+
// iOS (Required)
43+
// A unique string value of your choice that is hard to guess. Used to prevent CSRF.
44+
state: 'abcde',
45+
46+
// iOS, Android (Required)
47+
scopes: [
48+
'r_basicprofile',
49+
],
50+
51+
// iOS (Required)
52+
// The URI your users will be sent back to after authorization. This value must match one of the defined OAuth 2.0 Redirect URLs in your application configuration.
53+
// e.g. https://www.example.com/auth/linkedin
54+
redirectUri: 'https://github.com/joonhocho/react-native-linkedin-sdk/oauth2callback',
55+
});
56+
57+
const profile = await LinkedInSDK.getRequest('https://api.linkedin.com/v1/people/~?format=json');
58+
59+
setTimeout(() => {
60+
alert(JSON.stringify({token, profile}, null, ' '));
61+
}, 1500);
62+
}}>
63+
<Text style={styles.instructions}>
64+
LinkedIn Sign-In
65+
</Text>
66+
</TouchableHighlight>
2967
</View>
3068
);
3169
}

0 commit comments

Comments
 (0)