mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 16:36:35 +00:00
load api subendpoints
This commit is contained in:
36
src/pages/ipa/guides/authentication.mdx
Normal file
36
src/pages/ipa/guides/authentication.mdx
Normal file
@@ -0,0 +1,36 @@
|
||||
import {HeroPattern} from "@/components/HeroPattern";
|
||||
export const description =
|
||||
'In this guide, we’ll look at how authentication works. NetBird offers two ways to authenticate your API requests: OAuth2 and personal access tokens.'
|
||||
|
||||
<HeroPattern/>
|
||||
|
||||
# Authentication
|
||||
|
||||
You'll need to authenticate your requests to access any of the endpoints in the NetBird API. In this guide, we'll look at how authentication works. Netbird offers two ways to authenticate your API requests: OAuth2 and personal access tokens (PAT). {{ className: 'lead' }}
|
||||
|
||||
## OAuth2 with bearer token
|
||||
|
||||
When establishing a connection using OAuth2, you will need your access token — you can retrieve one from your IDP manager. Here's how to add the token to the request header using cURL:
|
||||
|
||||
```bash {{ title: 'Example request with bearer token' }}
|
||||
curl https://api.netbird.io/api/users \
|
||||
-H "Authorization: Bearer {token}"
|
||||
```
|
||||
|
||||
Always keep your token safe and reset it if you suspect it has been compromised.
|
||||
|
||||
## Using personal access tokens
|
||||
|
||||
When establishing a connection using [PATs](/docs/how-netbird-works#personal-access-tokens), you will need your access token — you can create one in the [Netbird dashboard](#) under User settings. It is recommended to use [service users](/docs/how-netbird-works#service-users) for all organization wide flows calling the API. Here's how to add the token to the request header using cURL:
|
||||
|
||||
```bash {{ title: 'Example request with personal access token' }}
|
||||
curl https://api.netbird.io/api/users \
|
||||
-H "Authorization: Token {token}"
|
||||
```
|
||||
|
||||
Always keep your token safe and reset it if you suspect it has been compromised.
|
||||
|
||||
<div className="not-prose mb-16 mt-6 flex gap-3">
|
||||
<Button href="/docs/how-netbird-works#personal-access-tokens" arrow="right" children="How to create tokens" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user