Sign up

To register a new user, make a request to the /auth/signup endpoint of your project URL, including the email and password within the form fields. Upon successful completion of the request, the user will be logged in, allowing them to make requests to your protected API endpoints.

Example Request for User Signup

  curl --location 'https://my-project.fastgenapp.com/auth/signup' \
    --header 'rid: thirdpartyemailpassword' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "formFields": [
            {
                "id": "email",
                "value": "timon@fastgen.com"
            }, {
                "id": "password",
                "value": "<mySecretPassword1>"
            }
        ]
    }'

Sign in

Signing in is similar to signing up. Simply use the /auth/signin endpoint and provide the email and password through form fields.

Example Request for User Sign In

  curl --location 'https://my-project.fastgenapp.com/auth/signin' \
    --header 'rid: thirdpartyemailpassword' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "formFields": [
            {
                "id": "email",
                "value": "timon@fastgen.com"
            }, {
                "id": "password",
                "value": "<mySecretPassword1>"
            }
        ]
    }'

Authentication Modes

By default, authentication sessions are saved within cookies. This approach works great because cookies are often the most straightforward solution and most of the time you don’t have to actively remember to send them along in your requests. However, especially if the client is hosted on a different domain than fastgen, then cookie-based session management quickly falls apart because of cookies not working reliably across different top level domains.

Both the endpoints /auth/signup and /auth/signin can accept the following headers to enable header based authentication:

  • by setting the header 'st-auth-mode': 'header' you will receive the access token and refresh token in the response header
  • by setting the header 'fg-auth-mode': 'body' you will receive the access token and refresh token in the response body

Both approaches enable you to send the access token along as 'Authorization': 'Bearer <token> to authenticate your requests