The OAuth feature provides an OAuth library for use in your widgets.
You can see an example of it in action in the fbfriend widget which connects to Facebook.
Steps to create a widget connecting to oauthed services:
- Create a widget (for example with "ant seed-widget")
- Add the oauth feature into widget config.xml (example)
with the following parameters:
- clientId: your client id issued by authorization endpoint from oauthed service side
- authzServer: url of authorization endpoint
- scope: scope of token issued
- e.g.
- To make call to oauthed service,
- We obtain an access token by calling to oauth.authenticate()
- Then using calling oauth.proxify(service_url) in which url is the url of the oauthed service, by calling this function, access token will be automatically added to the request.
- To remove token from database, make call to oauth.invalidateToken()