<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@galvanize-inc/jwtdown-for-react](./jwtdown-for-react.md) &gt; [useToken](./jwtdown-for-react.usetoken.md)

## useToken variable

Hook that provides token, register, login, logout, fetchWithCookie, and fetchWithToken

**Signature:**

```typescript
useToken: () => {
  token: string | null;
  register: (userData: RegistrationData, url: string, method?: string) =>
    Promise<Boolean>;
  login: (username: string, password: string) => Promise<Boolean>;
  logout: () => Promise<Boolean>;
  fetchWithCookie: (url: string, method?: string, options?: object) =>
    Promise<any>;
  fetchWithToken: (
    url: string,
    method?: string,
    otherHeaders?: object,
    options?: object
  ) => Promise<any>;
};
```
