> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cocartapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication / Login

> Trouble with authentication?

> [accordion] Issue with authenticating in general?
>
> You may need to add this to your **.htaccess** file in the parent folder where your WordPress installation is. Once added, restart the server and authentication should work.
>
> ```apache theme={"system"}
> <IfModule mod_rewrite.c>
> RewriteEngine on
> RewriteCond %{HTTP:Authorization} ^(.*)
> RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
> </IfModule>
> ```

> [accordion] Basic authentication not working?
>
> Basic authentication is recommended to be used on secure sites that have SSL enabled, so if you attempting to authenticate CoCart without it being secured. Then it will simply fail.
>
> > [!NOTE]
> >
> > If you are testing on a local or development environment, CoCart will allow you to authenticate via the basic method.

> [accordion] How can I authenticate as a customer?
>
> CoCart supports all standard and additional support for identifying ways to login.
>
> * Username + Password
> * Email + Password
> * Billing Phone Number + Password
>
> How you choose to allow your customers to login is up to you.
>
> > [!NOTE]
> >
> > Should the customer forget the username they created or what was assigned when registering as a customer, using their email address instead is good alternative.
>
> ```bash cURL theme={"system"}
>     curl --request POST \
>         --url https://localhost/wp-json/cocart/v2/login \
>         --header "Authorization: Basic " + btoa('username:password')
>         --header "Content-Type: application/json"
> ```

> [accordion] Not possible to use authentication headers, alternative?
>
> If it is not be possible to authenticate the right way using the headers, you can authenticate the user via URL.
>
> ```bash theme={"system"}
> wp-json/cocart/v2/login?username=sebastien@domain.com&password=password
> ```
>
> Please keep your sites secure!


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.