Hello Manuel,
First of all, thank you very much for sharing this class. It seems great. Got it up and running for twitter in a whim.
However I'm now trying to get it to work with Stocktwits(.com) and can't seem to get it working.
Here's what I did. I added a case in oauth_client (to be able to share it with this community if it worked):
case 'StockTwits':
$this->oauth_version = '2.0';
$this->request_token_url = '';
$this->dialog_url = 'https://api.stocktwits.com/api/2/oauth/authorize?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&scope={SCOPE}&response_type=code&state={STATE}';//{RESPONSE_TYPE}
$this->append_state_to_redirect_uri = '';
$this->access_token_url = 'https://api.stocktwits.com/api/2/oauth/token';
$this->authorization_header = true;
$this->url_parameters = false;
break;
according to their documentation:
stocktwits.com/developers/docs/auth
...
then I made a copy of login_with_twitter.php and renamed it to login_with_stocktwits.php, and changed it like this:
$client = new oauth_client_class;
$client->debug = 1;
$client->server = 'StockTwits';
$client->response_type = 'code';
$client->scope = 'read,watch_lists,publish_messages,publish_watch_lists,direct_messages,follow_users,follow_stocks';
$client->redirect_uri = 'http://'.$_SERVER['HTTP_HOST'].
dirname(strtok($_SERVER['REQUEST_URI'],'?')).'/login_with_stocktwits.php';
$client->client_id = '079aba316a36d678'; $application_line = __LINE__;
$client->client_secret = 'my secret';
But all I get is a response code 400. This is the resulting url:
api.stocktwits.com/api/2/oauth/auth
...
Any idea of what I'm doing wrong.
I'm no expert on this subject and just broke my head over it for the last few hours. So I'm kinda depleted of things to try.
I can give yu my secret as well (as it's just a test account I made on stocktwits).
If I/we get this working, this could be merged with your class for anyone else to benefit (as there doesn't seem to be much support for Stocktwits on oauth clients as it seems). I know the guys at stocktwits, so they could then add your class to http://stocktwits.com/developers/docs/libraries
Kind regards and thank you for considering helping me out.
Dirk