Using PHP and curl to generate an access token with this url:
https://foursquare.com/oauth2/access_token?client_id=MY_CLIENT_ID&client_secret=MY_SECRET&grant_type=authorization_code&redirect_uri='.urlencode('MY_REDIRECT_URL').'&code='.$token['oauth_token']
This processes just fine and returns a token. This token only changes when I reset the consumer key and secret at foursquare.com
Using that token with
https://api.foursquare.com/v2/users/search?name=test&oauth_token=RETURNED_TOKEN
always returns a 401 error. I used these instructions https://developer.foursquare.com/overview/auth