[annotator-dev] How to use AnnotateIt.org with Store plugin

Nick Stenning nick at whiteink.com
Fri Mar 30 10:12:22 UTC 2012


On Wed, Mar 21, 2012 at 03:49, Kunal Kadakia <kadakiakunal at gmail.com> wrote:
> Hi Nick,
> I would like to store the annotations in annnotateit.org without having to
> log in to my annotateit.org account. In this way, I can have any user go to
> the page, create an annotation and store it in my annotateit.org account. Is
> this possible?

Yes, this is possible, but it requires a bit of work on your part, as
you'll need to setup an authtoken generator. You'll need to:

1) Register a consumer key/secret pair on AnnotateIt. You can do this
by going to "My Account" on AnnotateIt and clicking "Request a key »".

2) Set up a token generator on your website that issues tokens to all
users, perhaps setting their userId to their IP address. Information
on what a token generator does can be found at
https://github.com/okfn/annotator/wiki/Authentication

3) Set up the annotator to use your token generator:

   $('#content').annotator()
                .annotator('addPlugin', 'Auth', {
                  tokenUrl: 'http://yoursite.com/token'
                })
                .annotator('addPlugin', 'Store, {
                  prefix: 'http://annotateit.org/api'
                })

For further examples of this, perhaps see `dev.html` in the Annotator
repository, or have a look at the way OpenShakespeare integrates the
Annotator:

  # Annotator init code:
  https://github.com/okfn/shakespeare/blob/master/shakespeare/public/js/annotator.js
  (NB most of the userString/userAuthorize stuff here is legacy and
you can ignore it for your application)

  # Token generator controller:
  https://github.com/okfn/shakespeare/blob/master/shakespeare/controllers/token.py

  # Result:
  http://openshakespeare.org/work/hamlet

Hope this helps Kunal,

Best,
Nick




More information about the annotator-dev mailing list