vendor/braintree/braintree_php/lib/Braintree/OAuthGateway.php

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Braintree;

/**
 * Braintree OAuthGateway module
 * Creates and manages Braintree Addresses
 */
class OAuthGateway
{
    private $_gateway;
    private $_config;
    private $_http;

    // phpcs:ignore PEAR.Commenting.FunctionComment.Missing
    public function __construct($gateway)
    {
        $this->_gateway = $gateway;
        $this->_config = $gateway->config;
        $this->_http = new Http($gateway->config);
        $this->_http->useClientCredentials();

        $this->_config->assertHasClientCredentials();
    }

    /* Create an oAuth token from an authorization code
     *
     * @param mixed $params of request details
     *
     * @return Result\Successful|Result\Error
     */
    public function createTokenFromCode($params)
    {
        $params['grantType'] = "authorization_code";
        return $this->_createToken($params);
    }

    /* Create an oAuth token from a refresh token
     *
     * @param mixed $params of request details
     *
     * @return Result\Successful|Result\Error
     */
    public function createTokenFromRefreshToken($params)
    {
        $params['grantType'] = "refresh_token";
        return $this->_createToken($params);
    }

    /* Revoke an oAuth Access token
     *
     * @param mixed $params of request details
     *
     * @return Result\Successful|Result\Error
     */
    public function revokeAccessToken($accessToken)
    {
        $params = ['token' => $accessToken];
        $response = $this->_http->post('/oauth/revoke_access_token', $params);
        return $this->_verifyGatewayResponse($response);
后面还有 82 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。