使用 JS API 集成 LinkedIn 登錄 (Integrate LinkedIn login using JS API)


問題描述

使用 JS API 集成 LinkedIn 登錄 (Integrate LinkedIn login using JS API)

I am trying to integrate Login In Using LinkedIn. I am use LinkedIn's Javascript API. I have generated an application and API key. Then I have successfully imported their framework as mentioned in their example. I am not getting the login button it shows some error

<script type="text/javascript" src="http://platform.linkedin.com/in.js">
  api_key: my_api_key
  authorize: true
</script>

<body>
 <script type="in/Login">Hello, <?js= firstName ?> <?js= lastName ?>.</script>
</body>

When I specify the script in body, the tutorial says a LinkedIn sign in button appears, but for me an error prompts

Parse error: syntax error, unexpected '=' in /home/casarevi/public_html/lsign.php on line 12

參考解法

方法 1:

While the RIGHT thing to do here would be to turn off short_tags (as Adam has suggested), an easy workaround here is to change the code to read:

<script type="in/Login">
Hello, <?php echo '<';?>?js= firstName ?> <?php echo '<';?>?js=lastName ?>.
</script>

LinkedIn's Javascript API will treat this as the same.  Works like a charm without having to change your .ini settings.

方法 2:

Do you have PHP short_tags enabled?

(by MohandassbutangphpAdam Trachtenberg)

參考文件

  1. Integrate LinkedIn login using JS API (CC BY-SA 3.0/4.0)

#linkedin #login-script #javascript #API






相關問題

php中需要LinkedIn類型的朋友連接 (LinkedIn type friends connection required in php)

我可以在沒有明確用戶批准的情況下獲得 Linkedin oauth 訪問令牌嗎? (Could I get Linkedin oauth access token without explicitly user approve?)

Rails 3 Linkedin API 寶石 (Rails 3 Linkedin API gem)

如何在 iOS SDK 中獲取 LinkedIn 連接/朋友/聯繫人? (How to fetch LinkedIn connections/Friends/Contacts in iOS SDK?)

Linkedin 應用程序具有 OAuth 用戶令牌和 OAuth 用戶密鑰,它們會過期嗎? (Linkedin Application has OAuth User Token and OAuth User Secret, Do they Expire?)

LinkedIn 獲取個人資料提要或新聞提要 2015 (LinkedIn get profile feed or news feed 2015)

OAuth2::LinkedIn 錯誤 (OAuth2::Error with LinkedIn)

如果 Android 中未安裝 LinkedIn 本機應用程序,如何使用 LinkedIn 登錄和發布? (How to login and post with LinkedIn if LinkedIn native app is not installed in android?)

使用 JS API 集成 LinkedIn 登錄 (Integrate LinkedIn login using JS API)

Linkedin oauth2 r_liteprofile 沒有從 api 返回 (Linkedin oauth2 r_liteprofile not being returned from api)

LinkedIn OAuth2.0 使會話無效/強制重新授權 (LinkedIn OAuth2.0 Invalidate Session / Force re-authorization)

LinkedIn API v2 獲取用戶信息 (LinkedIn API v2 get user info)







留言討論