@nextcloud/auth
Version:
Nextcloud helpers related to authentication and the current user
36 lines (26 loc) • 1.05 kB
Markdown
<!--
- SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: GPL-3.0-or-later
-->
# @nextcloud/auth
[](https://api.reuse.software/info/github.com/nextcloud-libraries/nextcloud-auth)
[](https://www.npmjs.com/package/@nextcloud/auth)
[](https://nextcloud-libraries.github.io/nextcloud-auth/index.html)
Nextcloud helpers related to authentication and the current user
## Install
```sh
npm install @nextcloud/auth --save
```
```sh
yarn add @nextcloud/auth
```
## Usage
For detailed information check [the package documentation](https://nextcloud-libraries.github.io/nextcloud-auth/index.html).
One example usage to get the current user:
```ts
import { getCurrentUser } from '@nextcloud/auth'
const user = getCurrentUser()
if (user.isAdmin) {
// do something
}
```