Sometimes when developing OpenSocial gadgets for IBM Connections, you just need to purge the OAuth tokens.

For example when you've rebuilt the system which hosts the OAuth2 provider, you'll need everyone to do the OAuth dance again.

It's easy, but I normally forget the command. Here's how:


# Start the WebSphere admin client
cd /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin
./wsadmin.sh -lang jython -user wasadmin -password passw0rd

# Access the News Admin script
execfile("newsAdmin.py")

# Purge all OAuth2 tokens - sledgehammer approach
NewsOAuth2ConsumerService.purgeAllTokens()

While you're here, you may as well also clear the widget cache:


NewsWidgetCatalogService.clearWidgetCaches()

This removes any cached copies of OpenSocial gadgets or iWidgets from the Widget Container cache. It can also be useful during development.