无法检索reddit用户身份

I need only to authenticate Reddit users in to my website (in php). I'm using simple file_get_contents with stream_context_create for headers. I have already implemented Facebook user authentication.

For Reddit, I can successfully get an access_token. But when I GET request /api/v1/me with that access_token, I'm always getting HTTP/1.1 403 Forbidden.

Please Help.

This is the php code I'm using after I receive access_token

$opts = array('http' =>
    array(
    'method'  => 'GET',
    'header' => 'Authorization: bearer '.$result->access_token)
);
$context  = stream_context_create($opts);
$result = file_get_contents('https://oauth.reddit.com/api/v1/me', false, $context);

Is there anything I'm missing..

Here is the var_dump

array(7) {
  [0]=>  string(22) "HTTP/1.1 403 Forbidden"
  [1]=>  string(24) "Server: cloudflare-nginx"
  [2]=>  string(35) "Date: Sun, 23 Nov 2014 06:XX:XX GMT"
  [3]=>  string(38) "Content-Type: text/html; charset=UTF-8"
  [4]=>  string(17) "Connection: close"
  [5]=>  string(139) "Set-Cookie: __cfduid=XXXXXXXX; expires=Mon, 23-Nov-15 06:XX:XX GMT; path=/; domain=.reddit.com; HttpOnly"
  [6]=>  string(28) "CF-RAY: XXXXXXXXX-XXX"
}

Per the reddit API rules, you need to send a unique User-Agent with your request.

Change your client's User-Agent string to something unique and descriptive, preferably referencing your reddit username.
Example: User-Agent: flairbot/1.0 by spladug
Many default User-Agents (like "Python/urllib" or "Java") are drastically limited to encourage unique and descriptive user-agent strings.