Document the onLogin callback

parent 796177f0
......@@ -86,5 +86,25 @@ of the user on that service. This list is in addition to the public
Each service description is an object with the keys:
* `authority` _String_. The domain name which the annotation service is associated with.
* `grantToken` _String|null_. An OAuth grant token which the client can exchange for an access token in order to make authenticated requests to the service. If _null_, the user will only be able to read rather than create or modify annotations. (Default: _null_)
* `icon` _String|null_. The URL to an image for the annotation service. This image will appear to the left of the name of the currently selected group. The image should be suitable for display at 16x16px and the recommended format is SVG.
* `onLogin` _function_. A JavaScript function that the Hypothesis client will
call in order to login (for example, when the user clicks a login button in
the Hypothesis client's sidebar).
This setting can only be [set using window.hypothesisConfig](#configuring-the-client-using-javascript).
If the hosting page provides an `onLogin` function then the Hypothesis client
will call this function instead of doing its usual procedure for logging in
to the public service at [hypothes.is](https://hypothes.is/).
No arguments are passed to the `onLogin` function.
The `onLogin` function should cause a login procedure for the hosting page
to be performed - for example by redirecting to a login page, or by opening
a popup login window. After a successful login the hosting page should
reload the original page with a non-null `grantToken` for the logged-in user
in the `services` configuration setting.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment