Skip to main content
All CollectionsAPI
Authentication
Authentication

How to generate an API token

David Link avatar
Written by David Link
Updated over 3 months ago

Overview

This document provides information on how to authenticate with the API for the application at Euler. The API supports token-based authentication, where the user submits their email and password to receive an access token, which will be used for subsequent requests.

Endpoint

URL

POST https://tryeuler.bubbleapps.io/api/1.1/wf/generate-api-token

Method

POST

Request Format

The API expects the email and password of a user to be sent in the body of the request.

Request Headers

Header

Value

Content-Type

application/json

Request Body

The body should be formatted as JSON with the following fields:

Field

Type

Description

email

string

The email address of the user.

password

string

The user's password.

Example Request Body

{ 
"email": "[email protected]",
"password": "userpassword"
}

Successful Response

If the email and password are correct, the API will return a JSON response containing the authentication token, user ID, and the token expiration time.

Response Format

{ 
"status": "success",
"response": {
"token": "bus|1234567890123x123456789012345678|2345678901234x98",
"user_id": "1234567890123x12",
"expires": 31536000
}
}

Fields

Field

Type

Description

status

string

Will be "success" if the request is successful.

token

string

The bearer token to be used for future requests.

user_id

string

The ID of the authenticated user.

expires

int

The expiration time for the token, in seconds (in this case, one year).

Example cURL Request

curl -X POST https://tryeuler.bubbleapps.io/api/1.1/wf/generate-api-token \ 
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "userpassword"
}'

Error Response

If the credentials are invalid, the API will return a 400 error with a detailed message.

Example Error Response

{ 
"statusCode": 400,
"reason": "INVALID_LOGIN_CREDENTIALS",
"message": "We didn’t find an account with those login credentials",
"args":
{ "bubble_code": "2345678901234x987654321098765432"
}
}

Fields

Field

Type

Description

statusCode

int

HTTP status code for the error.

reason

string

The reason for the error.

message

string

A user-friendly message describing the error.

args

object

Additional information about the error (internal codes).

Authentication for Subsequent Requests

After receiving the token, it should be included in the Authorization header for all subsequent requests as a Bearer token.

Example Request With Token

curl -X GET https://tryeuler.bubbleapps.io/api/1.1/some-protected-endpoint \ 
-H "Authorization: Bearer bus|1234567890123x123456789012345678|2345678901234x98"

Did this answer your question?