Git Product home page Git Product logo

Comments (3)

stevenmaguire avatar stevenmaguire commented on July 20, 2024

I ran into this issue as well and I've submitted a PR that addresses, but it is not "clean" and I am on the fence about the actual solution.

#50

from oauth1-client.

isleshocky77 avatar isleshocky77 commented on July 20, 2024

@stevenmaguire I'm glad I'm not crazy and that other people have run into this issue. We can close this issue if that PR solves the problem. I can take a look at a later time.

from oauth1-client.

shoutershub avatar shoutershub commented on July 20, 2024

I'm using thephpleague/oauth1-client with an OAuth1 server which will only work if the oauth_verifier is present in the header instead of as a body parameter which is how it currently is implemented.

In order to get around this limitation and have this client work I implemented the following method in my Server file.

    /**
     * {@inheritDoc}
     */
    protected function protocolHeader($method, $uri, CredentialsInterface $credentials, array $bodyParameters = array())
    {
        $parameters = array_merge(
            $this->baseProtocolParameters(),
            $this->additionalProtocolParameters(),
            array(
                'oauth_token' => $credentials->getIdentifier(),
            )
        );

        /**
         * BEGIN: Modification to parent::protocolHeader()
         * Note: THE API will not accept oauth_verifier as a body parameter. It must be in the OAuth Authorization
         * header
         */
        if (isset($bodyParameters['oauth_verifier'])) {
            $parameters['oauth_verifier'] = $bodyParameters['oauth_verifier'];
            unset($bodyParameters['oauth_verifier']);
        }
        /**
         * END: Modification to parent::protocolHeader()
         */

        $this->signature->setCredentials($credentials);

        $parameters['oauth_signature'] = $this->signature->sign(
            $uri,
            array_merge($parameters, $bodyParameters),
            $method
        );

        return $this->normalizeProtocolParameters($parameters);
    }

I'm not enthused about this solution and was looking to see if there was a more elegant solution.

Note: With a little bit of a research I don't believe the spec states that it should or shouldn't be in the header or the body; however, some have stated that it makes more sense to have it in the header with the rest of the oauth_parameters.

Holy molly, u just saved me 2days of research, i almost lost it.

from oauth1-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.