@@ -206,3 +206,43 @@ stdClass Object
206
206
207
207
You can find out how to build the Codebird method name, in the section
208
208
‘Mapping API methods to Codebird function calls.’
209
+
210
+ How Do I…?
211
+ ==========
212
+
213
+ …get user ID, screen name and more details about the current user?
214
+ ------------------------------------------------------------------
215
+
216
+ When the user returns from the authentication screen, you need to trade
217
+ the obtained request token for an access token, using the OAuth verifier.
218
+ As discussed in the section ‘Usage example,’ you use a call to
219
+ ``` oauth/access_token ``` to do that.
220
+
221
+ The API reply to this method call tells you details about the user that just logged in.
222
+ These details contain the ** user ID** and the ** screen name.**
223
+
224
+ Take a look at the returned data as follows:
225
+
226
+ ```
227
+ stdClass Object
228
+ (
229
+ [oauth_token] => 14648265-rPn8EJwfB**********************
230
+ [oauth_token_secret] => agvf3L3**************************
9713
code>
231
+ [user_id] => 14648265
232
+ [screen_name] => mynetx
233
+ [httpstatus] => 200
234
+ )
235
+ ```
236
+
237
+ If you need to get more details, such as the user’s latest tweet,
238
+ you should fetch the complete User Entity. The simplest way to get the
239
+ user entity of the currently authenticated user is to use the
240
+ ``` account/verify_credentials ``` API method. In Codebird, it works like this:
241
+
242
+ ``` php
243
+ $reply = $cb->account_verifyCredentials();
244
+ print_r($reply);
245
+ ```
246
+
247
+ I suggest to cache the User Entity after obtaining it, as the
248
+ ``` account/verify_credentials ``` method is rate-limited by 15 calls per 15 minutes.
0 commit comments