Search code examples
javascriptlinkedin-api

How to display LinkedIn Sign In button?


I'm trying to build a LinkedIn login on my (Flask) website. For this I'm following the steps I found here: https://developer.linkedin.com/documents/getting-started-javascript-api

I followed the steps 1 to 4, but from there I'm a bit stuck. I currently have the following code:

<!DOCTYPE html>
<head>    
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
    api_key: "7762qdzr8qe7db";
</script>
</head>
<body>
<h1>Sign In with LinkedIn</h1>
<script type="in/Login">
    Hello, <?js= firstName ?> <?js= lastName ?>.
</script>
</body>
</html>

Supposedly this should show Sign In with LinkedIn button, but I see absolutely nothing. I'm running this on localhost (url being http://127.0.0.1:5000/linkedin), but according to the same page I linked at the top, during development that shouldn't be a problem ("During development, 'localhost' works!").

In the screenshots below you'll see that I correctly copy-pasted the API key in the js above:

enter image description here

and even though I use localhost, below you'll see I correctly listed my domain with port 5000 (I also tried without a port):

enter image description here

I also tried putting this html on my TLD, but also to no avail (plus I guess it should work on localhost too). Does anybody know what I'm doing wrong here? All tips are welcome!

[EDIT] The problem turned out to be threefold. I needed to

  1. add http://localhost to the comma separated list of JavaScript API Domains on linkedin.com/secure/developer
  2. visit http://localhost:5000 instead of 127.0.0.1:5000
  3. remove the quotes and semicolon so that the line reads api_key: 7762qdzr8qe7db

Thanks for all the help!


Solution

  • The problem is threefold. You need to

    1. add http://localhost to the comma separated list of JavaScript API Domains on linkedin.com/secure/developer
    2. visit http://localhost:5000 instead of 127.0.0.1:5000
    3. remove the quotes and semicolon so that the scripts looks as follows <script type="text/javascript" src="http://platform.linkedin.com/in.js"> api_key: 7762qdzr8qe7db </script>