Custom login using the API
This article describes how to login the user in the browser by using the Ideanote API. This technique can be used when JWT, SAML or OpenID isn't an option. In order to log in the user, you will have to follow these steps:
- Create or update the user and obtain the user's
session token
. - Generate a link using the
session token
that can be used to automatically log in the user in the browser.
1. Create or update the user and obtain the user's session token
.
The following JSON endpoint will automatically create the user if it doesn't exist or update the user if it already exists. The endpoint returns a session object with a sessionToken
.
POST https://api.ideanote.io/v1/session?fields=kind,user.id,sessionToken
Body parameters:
Name | Description | ||||||||||||||||
| The ID of your workspace | ||||||||||||||||
| This key needs to always be set to the value: | ||||||||||||||||
| A data object describing the user details
|
Example Request:
curl "https://api.ideanote.io/v1/session?fields=kind,user.id,sessionToken" \
-H "Content-Type: application/json" \
-d '{
"spaceId": "b06f0a9a-4813-4515-81a0-29e8f2d193ec",
"kind": "CUSTOM",
"data": {
"email": "john@doe.com",
"apiToken": "f2dacce1fe557c7f140a3f7e85",
"name": "John Doe",
"avatarUrl": "https://avatars.githubusercontent.com/u/1234"
}
}'
Example Result:
{
"sessionToken":"41b0d309e0e4a341eccf611f9a70cbb91a6a_164864564232",
"user": ...
}
Generate a link using the session token
that can be used to automatically log in the user in the browser.
After obtaining the sessionToken
of the user, you can generate a link that can be used to log in the user directly in the browser.
Link directly to the webapp:
https://{{SUBDOMAIN}}.ideanote.io/login/session/{{SESSION_TOKEN}}
Example:
https://mysubdomain.ideanote.io/login/session/41b0d309e0e4a341eccf611f9a70cbb91a6a_164864564232
Link directly to the widget
First you will have to get a widget link. This can be found by sharing a mission, editting the embed code and getting a "full page" widget link.
Afterwards you will have to extend the URL with the query parameter: &auth.sessionToken={{SESSION_TOKEN}}
.
https://idea-widget.ideanote.io/idea-confirmation?config={{WIDGET_ID}}&auth.sessionToken={{SESSION_TOKEN}}
Example:
https://idea-widget.ideanote.io/idea-confirmation?config=df828665bf&auth.sessionToken=41b0d309e0e4a341eccf611f9a70cbb91a6a_164864564232