Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Facebook "An active token must be used" error [0.7.1] #103

Open
trafnar opened this Issue · 6 comments

4 participants

@trafnar

I was successfully using 0.0.3 to access facebook and I'm trying to upgrade to 0.7.1. I've followed the example quite closely and read through the issues but always run into the error:

An active access token must be used to query information about the current user.

I'm not sure if that means I'm somehow not using an access token, or that my access token is not "active".

Here is the code I am using:

# create client
client = OAuth2::Client.new(APP_ID, APP_SECRET, :site => BASE_URL, :token_url => '/oauth/access_token')

# get auth url
client.auth_code.authorize_url(:redirect_uri => CALLBACK_URI)

# create token
token = client.auth_code.get_token(params[:code], :redirect_uri => CALLBACK_URI)

# attempt get
token.get('/me') # => "An active access token must be used to query information about the current user."

Is there an obvious mistake I am making here?

@bastilian

I do have the same issue with the same exact steps.
Did you find a solution?

@trafnar

I did not find a solution. I'm now using another gem specific to Facebook.

@bastilian

Yeah, me too. I used Koala instead. (https://github.com/arsduo/koala)
Would still be nice to find out what the issue is (some other day :) ).

@trafnar

hehe, yes that's exactly what I did.

@Ivangrx

I also have the exact same issue... Any clue on this...??? I really want to keep using this gem...

@ylg

The Client doesn't push it's options into new tokens, i.e., if you've set :mode => :param and :param_name => 'access_token' for Facebook in your client instance, the token instance it creates will not have those set (unless you pass them as options to #get_token.) This means the token reverts to the default (as of 0.8.0) of a bearer token HTTP header for it's requests. See Gate's answer at http://stackoverflow.com/a/7309641/437273 for more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.