forked from openannotation/annotator
-
Notifications
You must be signed in to change notification settings - Fork 1
Auth Plugin
ikr edited this page Apr 2, 2013
·
5 revisions
The Auth plugin complements the Store Plugin by providing authentication for requests. This may be necessary if you are running the Store on a separate domain or using a third party service like annotateit.org.
The plugin works by requesting an authentication token from the local server and then provides this in all requests to the store. For more details see the specification.
Adding the Auth plugin to the annotator is very simple. Simply add the annotator
to the page using the .annotator() jQuery plugin. Then call the .addPlugin()
method eg. .annotator('addPlugin', 'Auth').
var content = $('#content'));
content.annotator('addPlugin', 'Auth', {
tokenUrl: '/auth/token'
});The following options are available to the Auth plugin.
-
tokenUrl: The URL to request the token from. Defaults to/auth/token. -
token: An auth token. If this is present it will not be requested from the server. Defaults tonull. -
autoFetch: Whether to fetch the token when the plugin is loaded. Defaults totrue
For details of the token format, see the page on Annotator's Authentication system.