8000 Update README with info about how to get details of the current user · codezninja/codebird-php@2eb4390 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2eb4390

Browse files
committed
Update README with info about how to get details of the current user
1 parent 1cdbacc commit 2eb4390

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,43 @@ stdClass Object
206206

207207
You can find out how to build the Codebird method name, in the section
208208
‘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**************************
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

Comments
 (0)
0