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

# Auth service

The `AuthService` is used to retrieve all user-related data and authenticate the user. You can import the `AuthService` from the `experro-storefront` package.

```js theme={null}
import { AuthService } from 'experro-storefront';
```

Here is a list of functions that the `AuthService` provides.

1. [`isUserLoggedIn`](#isuserloggedin)
2. [`getUserDetails`](#getuserdetails)
3. [`setUserDetails`](#setuserdetails)
4. [`login`](#login)
5. [`logout`](#logout)
6. [`signup`](#signup)
7. [`forgotPassword`](#forgotpassword)

***

## isUserLoggedIn

This function returns either `false` or `true` to indicate whether the user is logged in or not.

```js theme={null}
const isLoggedIn = AuthService.isUserLoggedIn();
```

***

## getUserDetails

This function returns the user details including cart, store, and user information.

```js theme={null}
const userObj = AuthService.getUserDetails();
```

***

## setUserDetails

This function is used to update the details of the user. It takes `userDetails` as the parameter.

```js theme={null}
const userObj = AuthService.setUserDetails(userDetails);
```

***

## login

This function is used to login to the base theme. The function accepts an object with `username` and `password` as two properties.

```js theme={null}
const userObj = AuthService.login({username, password});
```

***

## logout

This function logs you out from the base theme.

```js theme={null}
AuthService.logout();
```

***

## signup

This function is used to register the user details. This function accepts an object with `firstName`, `lastName`, `email`, `password`, `phone`, `company`, and `customFields` as properties of the object.

```js theme={null}
const user = AuthService.signup({
  firstName,
  lastName,
  email,
  password,
  phone,
  company,
  customFields,
});
```

***

## forgotPassword

The function is used to reset the password. This function accepts an object with `email` as the property of the object.

```js theme={null}
const res = AuthService.forgetPassword({ email });
```
