Bearer Token in Upload with Media - Do I need it?


I have an Upload_with_Media option on my website so members can sign in with Twitter and post a tweet with image from my site to their Twitter account. I currently use their tokens in a $_SESSION[‘access_token’] & $_SESSION[‘access_token_secret’] from their sign in to complete the request (to post a tweet with image).

I’ve recently update the oauth library I use (tmh_oauth) and it was working fine. However it recently stopped working when using $_SESSION tokens. I’ve checked the code still works when hard coding the tokens from my application into the php file and it works fine?

My question is…Do I need a valid Bearer Token in my code when using $_SESSION tokens? There is a space for it in the php file (see extract from tmhOAuthExample.php) below.

        // change the values below to ones for your application
        'consumer_key'    => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
        'consumer_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        'token'           => $_SESSION['access_token'],
        'secret'          => $_SESSION['access_token_secret'],
        'bearer'          => 'YOUR_OAUTH2_TOKEN',

These $_SESSION tokens work in a search I’m doing for tweets, so it’s a little confusing.

Thanks very much