How can I get a unique identifier associated with a meetup access token?

387 Views Asked by At

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?

2

There are 2 best solutions below

0
On

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.

0
On

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.