Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

able to retrieve profile details by providing another application's clientId and clientSecret #65

Open
rakesh1988 opened this issue Dec 10, 2016 · 6 comments

Comments

@rakesh1988
Copy link

Let's say I have app A and app B.
On my android app I use client id of app A and generate a token. I send it to my server for verification. In my server I use app B's client id and client secret.
In the above scenario, should the auth succeed or fail?

My understanding is, it should fail. But I am able to retrieve user's profile details.

@ghaiklor
Copy link
Collaborator

@rakesh1988 we are using hmac proof as documented on Facebook documentation. It shouldn't really work 🤔

@twelve17
Copy link

twelve17 commented Apr 19, 2017

I seem to be able to get the profile with an invalid client id altogether, e.g.:

 passport.use(new FacebookTokenStrategy({ 
   clientID: "bad", 
   ...

Since the access token is sufficient to make calls to the graph API, I think the library might using it as-is, without needing an app ID and secret, to get the profile:

passport-facebook-token/lib/index.js:

authenticate(req, options) {
    const accessToken = this.lookup(req, this._accessTokenField);
    const refreshToken = this.lookup(req, this._refreshTokenField);

    if (!accessToken) return this.fail({message: `You should provide ${this._accessTokenField}`});

    this._loadUserProfile(accessToken, (error, profile) => {
    ...

On my end, I am running Facebook's "debug token" endpoint to perform additional validation of the token using the client ID and secret. Might be handy if this NPM optionally does that, otherwise, I think no authentication is being done here, just a call to the graph API to get the profile given the access token.

@twelve17
Copy link

twelve17 commented Apr 19, 2017

My apologies, I see now where the code is using the "enable_proof"feature with the app secret.

I think this works for me because I am using a single app (unlike the OP), and it seems the clientID param is essentially unused since the appsecret_proof only requires the secret.

However, now I am perplexed too about the OP's use case. @rakesh1988, are you by chance using the same app secret for both apps? This shouldn't be a problem, but if it were the case, and the behavior is reproducible, that would be quite interesting!

@twelve17
Copy link

@rakesh1988 - On Facebook's Dev site, do you have "Require App Secret" enabled on your app? The docs make it sound like their API should perform the additional verification if the appsecret_proof query param is present, even if that switch is disabled, but I'd be curious if you can still get the profile if this switch is enabled in your apps.

@twelve17
Copy link

For what it's worth, I was unable to reproduce this with the steps provided by the OP. I get an error which includes this from the Facebook API:

oauthError": {
      "statusCode": 400,
      "data": "{\"error\":{\"message\":\"Invalid appsecret_proof provided in the API argument\",\"type\":\"GraphMethodException\",\"code\":100,\"fbtrace_id\":\"XYZ\"}}"
    },

@ravindersgh90
Copy link

I am getting similar error, can anybody suggest me how can I fix it.

oauthError": {
"statusCode": 400,
"data": "{"error":{"message":"Invalid appsecret_proof provided in the API argument","type":"GraphMethodException","code":100,"fbtrace_id":"XYZ"}}"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants