Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell's Blog:
PHP OAuth Provider: Request Tokens
May 20, 2011 @ 13:39:17

In the next of her series looking at OAuth in PHP, Lorna Mitchell has posted a look at request tokens and how to hand them out via your application.

The consumer requests a request token (see my earlier post about consuming OAuth), and as a provider, we need to handle that request. In my example, I chose to pass the variables as GET parameters, but you could adapt this to handle POST variables or information contained in HTTP headers.

She includes the code (using the functionality of the pecl_oauth extension) to provide a token and the three functions you'll need to define to get things working - the consumerHandler, the tokenHandler and timestampNonceHandler. She also includes a sample database table structure for storing the OAuth information for a user.

tagged: tutorial oauth provider request token pecloauth extension

Link:

Lorna Mitchell's Blog:
Invalid Protected Resource URL in pecl_oauth
Apr 12, 2011 @ 15:16:03

In a quick post to her blog today, Lorna Mitchell talks about an issue with pecl_outh tat came up during her development of a new API. A strange fatal error message was breaking her connection.

I'd gone through all the handshaking steps, got the acces token and was ready to start talking to the service itself. However when I tried to call OAuth::fetch, I got an error message: Fatal error: Uncaught exception 'OAuthException' with message 'Invalid protected resource url, unable to generate signature base string'

As it turns out, the issue was obscure - the address she was connecting to was missing a training slash (http://api.localhost versus http://api.localhost/) and it was causing the OAuth fetch to fail (apparently undocumented). If you're interested in some of the other things that have come up in her work with OAuth on the project, see here.

tagged: pecloauth oauth api protected resource url fatal error

Link:

Lorna Mitchell's Blog:
Missing pcre.h when installing pecl_oauth
Sep 27, 2010 @ 17:58:50

If you've ever come up against an error when trying to compile the pecl_oauth package (from the PECL repository), you might take a look at this new post from Lorna Mitchell on how she solved the issue and got the compile running smoothly again.

When I tried to install from PECL, it grabbed the files, ran the configure step but stopped with an error status during make. [...] Closer inspection showed this line around the point things started to go wrong: Error [...] pcre.h: No such file or directory. I didn't have the header files for pcre installed - in ubuntu the headers are in the -dev packages.

A quick call to "aptitude" to grab and install those development libraries and she was back up and running. She's running Ubuntu, but this tip is cross-distribution - you'll just have to use the package manager (and package name) of your distribution's choice.

tagged: pecloauth install compile pecl oauth pcre header

Link:


Trending Topics: