私はhttps://stackoverflow.com/a/40920748/3925032から引用していますが、質問は全く同じではないため、ここで回答しています。
必要ない:マニフェストのjwt。 manage_app_urlのために設定したあなたのウェブサイトのページでは、あなたが指摘したように、それがそれに追加されるので、あなたはjwtを聞きます。
*「oauth_final_destination」:「管理」を使用することもできます(インストール後にサイトを終了させる場合)。
{
"manifest": "1",
"version": "1.1.1",
"client_id" : "123456789101112",
"callback_url" : "https://www.your-domain.com/callback.php",
"scopes": ["read:site", "write:site"],
"manage_app_url": "https://www.your-domain.com/manage.php",
"oauth_final_destination" : "manage",
"locale": {
"default": "en-us",
"supported": ["en-us"]
},
"webhooks": {
"callback_url": "https://www.your-domain.com/webhooks.php",
"events": ["app.uninstall", "site.publish", "site.delete"]
},
"snippet": "files/assets/snippet.tpl"
}
は、あなたのサイトのmanage_app_urlのページでは、どうなる:
require('firebase/src/JWT.php');
use \Firebase\JWT\JWT;
if (isset($_GET['jwt'])) {
$app_client_id = "Your APP ID";
$client_secret = "Your APP SECRET";
$jtw = $_GET['jwt'];
/**
* You can add a leeway to account for when there is a clock skew times between
* the signing and verifying servers. It is recommended that this leeway should not be bigger than a few minutes.
* Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
*/
try {
JWT::$leeway = 60; // $leeway in seconds
$decoded = JWT::decode($jtw, $client_secret, array('HS256'));
if (!empty($decoded)) {
$decoded_array = (array) $decoded;
// Continue with your websites code to verify the Weebly users info
// $decoded_array['user_id'];
// $decoded_array['site_id'];
// $decoded_array['iat'];
// $decoded_array['jti'];
// $decoded_array['callback_url'];
}
} //END TRY
catch (InvalidArgumentException $e) {
echo $e->getMessage();
}
catch (UnexpectedValueException $e) {
echo $e->getMessage();
}
catch (DomainException $e) {
echo $e->getMessage();
}
}// END IF ISSET JWT