Via API

Custom Login via API is only possible when enabled from the backend by Ideanote, please contact us if you would like to use this authentication method.

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 automatically log in the user in the browser.

Create or Update the User and Obtain the 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

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.

locale

The locale of the user

Example Request:

Bash

 
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:

JSON

 
{  "sessionToken":"41b0d309e0e4a341eccf611f9a70cbb91a6a_164864564232",  "user": ...}

Generate a Login Link using the Session Token

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:

Automatic

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:

Automatic

https://idea-widget.ideanote.io/idea-confirmation?config=df828665bf&auth.sessionToken=41b0d309e0e4a341eccf611f9a70cbb91a6a_164864564232

Previous
Next
SHARE
Copy Link
AUTHOR
Jakob Storjohann
Was this article helpful?