Skip to content

Doubtfire API Documentation

API: Auth

auth : Operations about auth

This markdown document provides detailed documentation for the “auth” API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl

This “auth” API has the following operations.

  • DELETE /api/auth
  • POST /api/auth
  • PUT /api/auth
  • GET /api/auth/signout_url
  • GET /api/auth/method
  • POST /api/auth/jwt

DELETE: Deletes authentication.

  • URL: /api/auth

  • Method: DELETE

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response:

    • 204 No Content: Authentication deleted successfully.
  • Example Request:

    Terminal window
    curl -X DELETE --header 'Accept: application/json' --header 'username: student_1' --header 'auth_token: RbYVL1screzs9QGbAkd' 'http://localhost:3000/api/auth' curl -X DELETE http://doubtfire.com/api/auth

POST: Sign in

  • URL: /api/auth

  • Method: POST

  • Parameters: Authentication data

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameformDatastringYes
    passwordUser passwordformDatastringYes
    rememberUser has requested to remember loginformDataboolean
  • Response: 201 Created

  • Example Request:

    Terminal window
    curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'username=student_1&password=password&remember=false' 'http://localhost:3000/api/auth'
  • Response body:

    {
    "user": {
    "id": 24,
    "student_id": null,
    "email": "student_1@doubtfire.com",
    "first_name": "Layla",
    "last_name": "Kihn",
    "username": "student_1",
    "nickname": "student_1",
    "receive_task_notifications": true,
    "receive_portfolio_notifications": true,
    "receive_feedback_notifications": true,
    "opt_in_to_research": null,
    "has_run_first_time_setup": false,
    "system_role": "Student"
    },
    "auth_token": "zCQZnhmXzqhNzaxw17Qx"
    }

PUT: Allow tokens to be updated

  • URL: /api/auth

  • Method: PUT

  • Parameters: Authentication data

    ParameterDescriptionParameter TypeData TypeMandatory
    UsernameUser usernameformDatastringYes
    Auth_TokenAuthentication tokenheaderstringYes
    rememberUser has requested to remember loginformDataboolean
  • Response: 201 Created

  • Example Request:

    Terminal window
    curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header 'username: student_1' --header 'auth_token: zCQZnhmXzqhNzaxw17Qx' -d 'remember=false' 'http://localhost:3000/api/auth'
  • Response body:

    {
    "auth_token": "zCQZnhmXzqhNzaxw17Qx"
    }

GET: Authentication signout URL

GET /api/auth/signout_url

  • URL: /api/auth/signout_url

  • Method: GET

  • Parameters: None

  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/auth/signout_url'
  • Response body:

    {
    "auth_signout_url": null
    }

GET: Authentication method configuration

GET /api/auth/method

  • URL: /api/auth/method

  • Method: GET

  • Parameters: None

  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/auth/method'
  • Response body:

    {
    "method": "database",
    "redirect_to": null
    }

POST: SAML2.0 auth

POST /api/auth/jwt

  • URL: /api/auth/jwt

  • Method: POST

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    SAMLResponseData provided for further processingheaderstringYes
  • Response:

    • 201 Created: The JWT token is successfully generated.
  • Example Request:

    Terminal window
    curl -X POST https://your-institution-host/auth/jwt \
    -H "Content-Type: application/json" \
    -d '{
    "SAMLResponse": "Base64EncodedSAMLResponse"
    }'
  • Response body:

    {
    "token": "your-jwt-token",
    "user": {
    "email": "user@example.com",
    "name": "User Name"
    }
    }