我正在尝试在 ThingsBoard 实例中实现自定义 OAuth2 实现,因为我已经在 php 中实现了 OAuth2 服务器
https://github.com/bshaffer/oauth2-demo-php
http://brentertainment.com/oauth2/
按照他们的 bshaffer 演示,它工作正常,当我将它与第三方应用程序 thingboard 实例集成时,第一步工作正常,直到身份验证,然后它重定向到登录页面,指出 Oauth2 错误,但不知道它是什么,这里是示例OAuth2 服务器的 URL 和响应
http://34.226.xxx.xx/oauth2/web/lockdin/authorize
http://34.226.xxx.xx/oauth2/web/lockdin/token
http://34.226.xxx.xx/oauth2/web/lockdin/resource
步骤1:
第2步:
授权发生后,成功响应会发送回
在此之后它失败了
我已经测试了此后手动生成令牌的步骤及其工作正常
http://34.226.xxx.xx/oauth2/web/lockdin/token它给了我回应
{
"access_token": "4a01f8b9e8548420425c8f335eda2a3dbde7ef75",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "email",
"refresh_token": "ccbb9b8a03949e0e013acdb7f8e79426aa1a0a58"
}
Run Code Online (Sandbox Code Playgroud)
和资源 api 我得到以下响应
{
"email":"test@gmail.com",
"firstName":"Dave",
"lastName":"Johnson",
"profile":1828838378
}
Run Code Online (Sandbox Code Playgroud)
对此的任何帮助将非常感激
编辑:请找到终点的来源
授权.php
namespace OAuth2Demo\Server\Controllers;
use Silex\Application;
class Authorize
{
public static function addRoutes($routing)
{
$routing->get('/authorize', array(new self(), 'authorize'))->bind('authorize');
$routing->post('/authorize', array(new self(), 'authorizeFormSubmit'))->bind('authorize_post');
}
public …Run Code Online (Sandbox Code Playgroud) 海先来看看这个阵列,
Array
(
[0] => Array
(
[id] => 4
[parent_id] => 3
[children] => Array
(
[0] => Array
(
[id] => 7
[parent_id] => 4
[children] => Array
(
[0] => Array
(
[id] => 6
[parent_id] => 7
[children] => Array
(
[0] => Array
(
[id] => 2
[parent_id] => 6
)
)
)
)
)
)
)
[1] => Array
(
[id] => 5
[parent_id] => 3
)
)
Run Code Online (Sandbox Code Playgroud)
我需要一个所有id [IE:4,7,6,2,5]的输出是我需要的东西的理想结果
foreach ($tree as $j) …Run Code Online (Sandbox Code Playgroud)