易趣OAuth无法获取令牌
我正在尝试集成由David Sadler开发的GitHub。但我被卡在连接部件上了。我正在使用我的生产凭据获取应用令牌 但当我点击时,它给了我一个错误:易趣OAuth无法获取令牌,oauth,ebay-api,Oauth,Ebay Api,我正在尝试集成由David Sadler开发的GitHub。但我被卡在连接部件上了。我正在使用我的生产凭据获取应用令牌 但当我点击时,它给了我一个错误: [error] => invalid_grant [error_description] => the provided authorization grant code is invalid or was issued to another client SDK链接中提供了所有代码。如果您需要,这里是代码
[error] => invalid_grant
[error_description] => the provided authorization grant code is invalid or was issued to another client
SDK链接中提供了所有代码。如果您需要,这里是代码片段
<?php
/**
* Copyright 2017 David T. Sadler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Include the SDK by using the autoloader from Composer.
*/
require __DIR__ . '/../vendor/autoload.php';
/**
* Include the configuration values.
*
* Ensure that you have edited the configuration.php file
* to include your application keys.
*/
$config = require __DIR__ . '/../configuration.php';
/**
* The namespaces provided by the SDK.
*/
use \DTS\eBaySDK\OAuth\Services;
use \DTS\eBaySDK\OAuth\Types;
/**
* Create the service object.
*/
$service = new Services\OAuthService([
'credentials' => $config['production']['credentials'],
'ruName' => $config['production']['ruName'],
'sandbox' => false,
]);
$token = $config['production']['testToken']; ** This is the app token I get with http://localhost/ebay-sdk-examples/oauth-tokens/01-get-app-token.php **
/**
* Create the request object.
*/
$request = new Types\GetUserTokenRestRequest();
$request->code = $token;
// $request->code = 'v^1.1#i^1#I^3#r^1#p^3#f^0#t^Ul41XzA6MkIzRjJFRjA1MENDMzZCQjlGMjVERkYyMkMxMTRBM0VfMV8xI0VeMjYw';
/**
* Send the request.
*/
$response = $service->getUserToken($request);
echo '<pre>';
print_r($response);
echo '<pre>';
exit;
/**
* Output the result of calling the service operation.
*/
printf("\nStatus Code: %s\n\n", $response->getStatusCode());
if ($response->getStatusCode() !== 200) {
printf(
"%s: %s\n\n",
$response->error,
$response->error_description
);
} else {
printf(
"%s\n%s\n%s\n%s\n\n",
$response->access_token,
$response->token_type,
$response->expires_in,
$response->refresh_token
);
}
我目前也在使用此SDK
我的理解是,您应该放置url:
当您的授权人在developer.ebay.com中接受URL1时,在“通过您的应用程序从ebay获取令牌”下
当您设置$token时,应将其设置为$_GET['code'],因为在测试登录和接受时,应将您重定向到上述URL,并将?code=xxxx解析回该URL
当前设置为$token的值应设置为凭据中authToken的值
希望对您有所帮助。我目前也在使用此SDK
我的理解是,您应该放置url:
当您的授权人在developer.ebay.com中接受URL1时,在“通过您的应用程序从ebay获取令牌”下
当您设置$token时,应将其设置为$_GET['code'],因为在测试登录和接受时,应将您重定向到上述URL,并将?code=xxxx解析回该URL
当前设置为$token的值应设置为凭据中authToken的值
希望对您有所帮助。使用我们的定制PHP/.NET脚本可以生成易趣代币。易趣API文档有很多参考资料
以上链接包括生成易趣认证所需的所有详细信息。代币易趣代币的生成可以使用我们定制的PHP/.NET脚本实现。易趣API文档有很多参考资料
以上链接包括生成易趣认证所需的所有详细信息。令牌但ebay不接受http。只需要https,对吗?我们还可以在我使用的sdk(david sadler sdk)中动态传递重定向url吗?但是ebay不接受http。只需要https,对吗?我们还可以在我使用的sdk(david sadler sdk)中动态传递重定向url吗?
http://localhost/ebay-sdk-examples/oauth-tokens/02-get-user-token.php