如何整合linkedin登录:Codeigniter

时间:2018-01-24 13:14:43

标签: php linkedin

我试图将linkedin与我的代码集成。为此我可以从linkedin开发者帐户访问client_id和client_secret,并将此链接放入此

<a class="btn btn-linkedin" href="https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id='<?php echo $this->config->item('Client_ID'); ?>'&redirect_uri='<?php echo $this->config->item('callback_url'); ?>'&state=98765EeFWf45A53sdfKef4233&scope=r_basicprofile r_emailaddress"><img src="./images/linkedin_connect_button.png" alt="Sign in with LinkedIn"/></a>

当我点击此链接时,它将重定向到页面

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id='.$config['Client_ID'].'&redirect_uri='.$config['callback_url'].'&state=98765EeFWf45A53sdfKef4233&scope=r_basicprofile r_emailaddress

这是来自linkedin的错误页面。 还有一件事我从这个链接得到了这个参考 https://www.phpgang.com/how-to-login-with-linkedin-oauth2-in-php-and-mysql_3858.html

谁能告诉我哪里出错了? 提前谢谢。

1 个答案:

答案 0 :(得分:0)

只需删除&#34;&#39; &#39;&#34;因为你把php放在html而不是像tuto中那样的html中的html,那么你的代码将是这样的:

<a class="btn btn-linkedin" href="https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=<?php echo $this->config->item('Client_ID'); ?>&redirect_uri=<?php echo $this->config->item('callback_url'); ?>&state=98765EeFWf45A53sdfKef4233&scope=r_basicprofile r_emailaddress"><img src="./images/linkedin_connect_button.png" alt="Sign in with LinkedIn"/></a>