Difference between #6 and #7 of
How To Connect With Twitter From Yii

Revision #7 has been created by wei on Oct 26, 2010, 2:36:23 AM with the memo:

header formatting
« previous (#6)

Changes

Title unchanged

How To Connect With Twitter From Yii

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

twitter

Content changed

[...]
</form>
</div><!-- yiiForm -->
<? } ?>
```

### Capturing the Access Token --------------------------
 
After the user has authenticated with Twitter, your callback is called and the psYiiExtension library will pull out the new token and retrieve the permanent access token.
It is up to you to store this someplace. The library places the token in a user session state. You can retrieve the token via:
[...]
Save these off for later use. You can use a session variable or store them in your database.

### Authorization Event ----------------------
 
An alternate to this method is to use the <b>onUserAuthorized</b> event. This event is generated by the CPSOAuthComponent when authorization is complete. You must subclass CPSTwitterApi to capture this event and do with it what you please. Not a big deal, and kinda cool, no?

### Return trips to the site and reloading the token

After the session ends, the tokens are lost and you will need to load up your stored access tokens for the current user (or your site). This is done via the <b>CPSTwitterApi::loadData()</b> method.
It is up to you where you do this. Preferably, find a place where you actually need to use the Twitter API and load it there. Otherwise you'll end up loading it every time a page is loaded from your site and that's not very fast or Yii-like.
[...]
4 1
12 followers
Viewed: 33 883 times
Version: 1.1
Category: Tutorials
Tags: twitter
Written by: lucifurious
Last updated by: wei
Created on: Jun 11, 2009
Last updated: 14 years ago
Update Article

Revisions

View all history