Example of failed request

When user sends an unauthorized request, we probably face the error.

  1. Request expects JSON format

    Request:

    curl --location --request GET 'https://demo.ddev.site/api/demo/photos/1' \
        --header 'Accept: application/json'
    

    Response:

    {
        "error": "Authentication required."
    }
    

    Warning

    The response code will be 401

  2. Request expects HTML format

    Request:

    curl --location --request GET 'https://demo.ddev.site/api/demo/photos/1'
    

    In that case you will not get the error message, instead the request just forwarded to the login page.

Tip

plugin.tx_routes.settings.redirect.loginPage should be set to reflect the login page.