Turns out I use themattharris lib to get the login credentials (token
and token_secret) which I store on my db, and Abraham lib (yours) to
interact with Twitter once I am authenticated. I know this is not you
lib but Matt Harris's, but can you help me please to know where in the
mattharris lib should I change this method? I think it would be in the
line with the <-- below. Because Twitter every two days (more than
less) gives me this error when I try to get DMs with an authenticated
user [error] -> "no permission to access to DMS (or some like that)"
when I check the users Token and Secret in my app (
dev.twitter.com/
apps) they are different than the ones stored on my db. I appreciate
you help a lot.
// start the OAuth dance
} elseif ( isset($_REQUEST['signin']) || isset($_REQUEST['allow']) ) {
$callback = isset($_REQUEST['oob']) ? 'oob' : $here;
$code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/
request_token', ''), array(
'oauth_callback' => $callback
));
if ($code == 200) {
$_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth-
>response['response']);
$method = isset($_REQUEST['signin']) ? 'authenticate' :
'authorize'; <-- "HERE SHOULD I WRITE $METHOD='authorize'; RIGHT?"
$force = isset($_REQUEST['force']) ? '&force_login=1' : '';
$forcewrite = isset($_REQUEST['force_write']) ?
'&oauth_access_type=write' : '';
$forceread = isset($_REQUEST['force_read']) ?
'&oauth_access_type=read' : '';
header("Location: " . $tmhOAuth->url("oauth/{$method}", '') . "?
oauth_token={$_SESSION['oauth']['oauth_token']}{$force}{$forcewrite}
{$forceread}");
}
On Jul 5, 3:55 pm, Abraham Williams <
4bra...@gmail.com> wrote:
> You don't need to change the TRUE to FALSE in twitteroauth.php you pass
> FALSE as the second parameter when you call the getAuthorizeURL method. This
> is only used when a (generally) unauthenticated user gets redirected to
>
twitter.com with a request token to allow access to their account. For all
> existing users they will have to do this again before the access tokens will
> have DM access.
>
> In the example code this is done in line 22 of redirect.phphttps://
github.com/abraham/twitteroauth/blob/master/redirect.php#L22
>
> Abraham
> -------------