Michael Mackus
Michael Mackus

Reputation: 21

Google OAuth - how to reuse access token

I am a little confused how to use Google OAuth. From what I understand, the process is this:

  1. Get request token
  2. Authorize token
  3. Get access token

I can do all these steps successfully with the PHP library "oauth-php". However, I cannot figure out how to re-use the access token retrieved in the third step!

NOTE: I am using oauth-php's "Session" storage. There is a "mysql" storage option, but I cannot use this as my DBA is very strict on mysql stuff.

I have tried this code (which I think would be logical), but to no avail:

                $this->_store->addServerToken(
                $this->_oauthOptions['consumer_key'], // our consumer key
                'access', // the request token's type
                $accessToken, // the request token
                '', // token secret - is blank (we're using OpenID + OAuth) 
                0
            );

Upvotes: 0

Views: 1251

Answers (1)

Michael Mackus
Michael Mackus

Reputation: 21

I fixed the code.. I had some misunderstanding of OAuth and didn't realize I needed both the access token and the secret. Its working great now!

Upvotes: 1

Related Questions