3

I have implemented a simple api in python to get an OAuth2 access token from a user in meetup. How can I get a unique identifier from that user, using the access token, other than the token itself? For example, if I'm given an access token, how can I get that users email address?

whoan
  • 8,143
  • 4
  • 39
  • 48
user1876508
  • 12,864
  • 21
  • 68
  • 105

2 Answers2

2

You can make a call to https://api.meetup.com/2/member/self.

PHP example with cURL library:

$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, 'https://api.meetup.com/2/member/self');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Authorization: bearer ' . $accessToken
    ));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
$userData = json_decode($result);

You can get the ID from the user like $userData->id. As far as I know E-mail is not provided by this API call, at least not as a default anyway.

Ray Burgemeestre
  • 1,230
  • 8
  • 13
0

according to the docs here: http://www.meetup.com/meetup_api/docs/2/member/#get you should ask for the e-mail address by passing in the "fields=email" request parameter and this will return the e-mail address only if the following conditions are met:

email: Member's email address, if requested in fields parameter. This item is only included if the currently authenticated user is the founder of a Meetup Everywhere in which the member has elected to share an email address.

Hans Z.
  • 50,496
  • 12
  • 102
  • 115