You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script type="text/javascript" src="//platform.linkedin.com/in.js">
|
|
api_key: 81mvrv80ashgy2
|
|
authorize: true
|
|
onLoad: onLinkedInLoad
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
|
|
// Setup an event listener to make an API call once auth is complete
|
|
function onLinkedInLoad() {
|
|
console.log('load');
|
|
IN.User.authorize(lk);
|
|
IN.Event.on(IN, "auth", shareContent);
|
|
}
|
|
|
|
// Handle the successful return from the API call
|
|
function onSuccess(data) {
|
|
console.log(data);
|
|
}
|
|
|
|
// Handle an error response from the API call
|
|
function onError(error) {
|
|
console.log(error);
|
|
}
|
|
|
|
// Use the API call wrapper to share content on LinkedIn
|
|
function shareContent() {
|
|
|
|
// Build the JSON payload containing the content to be shared
|
|
var payload = {
|
|
"comment": "Check out developer.linkedin.com! http://linkd.in/1FC2PyG",
|
|
"visibility": {
|
|
"code": "anyone"
|
|
}
|
|
};
|
|
|
|
IN.API.Raw("/people/~/shares?format=json")
|
|
.method("POST")
|
|
.body(JSON.stringify(payload))
|
|
.result(onSuccess)
|
|
.error(onError);
|
|
}
|
|
|
|
function lk() {
|
|
console.log('login');
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |