"Credentials do not allow access to this resource [code] => 220"

php

#1

I am having problems using twitter to create new accounts on my site (but facebook is working fine).

Array ( [errors] => Array ( [0] => stdClass Object ( [message]
=> Your credentials do not allow access to this resource [code] =>
220 ) ) )

What does this mean? What is code 220?

I googled for help but other people say read/write but I checked my settings on the app and they are perfect so it’s some other problem.


#2

What resource are you trying to access?


#3

I’m confused, how does this work?


#4

$response = (array) $twitteroauth->get(‘account/verify_credentials’);

That command is returning this error


#5

Well right now it’s not working, but for facebook I can get it to provide the details my site needs to autopopulate an account.

It’s this command that produces the error:
$response = (array) $twitteroauth->get(‘account/verify_credentials’);

It gives error code 220: “Your credentials do not allow access to this resource [code]”

Why not? What do I need to do to fix this? Is there a setting or is it wrong to use the get function for this?


#6

It looks like you might be trying to use application-only auth which can only be used for API endpoints that don’t need a user context. Make sure you are following the 3-legged OAuth flow to get a user’s access token.


#7

The thing is I already implemented 3-legged OAuth and this code USED to work, I didn’t notice it stopped working until someone tried to create an account again using it (it worked a few months back when I last checked). But something on twitter’s end seems to have changed that I now get this 220 error (Your credentials do not allow access to this resource). I’m just very confused.


#8

@TallMike @abraham - did you ever get a solution to this? I’m looking at integrating the API that will allow the user add a friend, but I’m receiving this error too. I have 3-legged OAuth integrated and when the user is authorizing the app it has the permission ‘See who you follow, and follow new people.’ , but when I perform the call (friendships/create), I get that error. Any help is appreciated.


#9

It’s ok, all was fine. I found the error. I had the access token stored in a session variable and I was calling a proxy but didn’t have the session_start() call! All working.