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:

  1. Create or update the user and obtain the user's session token.
  2. Generate a link using the session token that can be used to automatucally 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/session

Body parameters:

Name

Description

spaceId

The ID of your workspace

kind

This key needs to always be set to the value: CUSTOM

data

A data object describing the user details

Name

Description

email (required)

The email of the user. We determine if there already exists a user on the workspace by finding an existing user with this email address.

apiToken (required)

The API token of an owner account on your workspace. This API token can be obtained from /settings/profile in the Ideanote webapp

sub

Optionally unique ID that will be used to find an existing user on the Ideanote workspace. If sub isn't provided, email will be used to find an existing user instead.

name

The name of the user

avatarUrl

A link to an image that should be used as avatar image for this user.

team

A team name that the user should be added to. The team will be created if it doesn't exists.

Example Request:
curl "https://api.ideanote.io/session" \
-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": ...
}

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.

https://{{SUBDOMAIN}}.ideanote.io/login/session/{{SESSION_TOKEN}}

Example:

https://mysubdomain.ideanote.io/login/session/41b0d309e0e4a341eccf611f9a70cbb91a6a_164864564232

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


How did we do?


Powered by HelpDocs (opens in a new tab)