> For the complete documentation index, see [llms.txt](https://api.circle.so/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.circle.so/apis/headless/auth-sdk/node.js/methods.md).

# Methods

The Headless Auth SDK is composed of the following methods:

[getMemberAPITokenFromCommunityMemberId](#getmemberapitokenfromcommunitymemberid)

[getMemberAPITokenFromEmail](#getmemberapitokenfromemail)

[getMemberAPITokenFromSSOId](#getmemberapitokenfromssoid)

[getMemberAPITokenFromRefreshToken](#getmemberapitokenfromrefreshtoken)

[revokeRefreshToken](#revokerefreshtoken)

[revokeMemberAPIToken](#revokememberapitoken)

## getMemberAPITokenFromCommunityMemberId

This function obtains a member `access_token` and `refresh_token` based on the community member's ID.&#x20;

### Request

```
const response = await client.getMemberAPITokenFromCommunityMemberId(MemberID);
```

### Accepted parameters

`memberID` - The Community Member ID. <mark style="color:red;">Required</mark>

### Response

```json5
{
    refresh_token: 'refresh_token',
    refresh_token_expires_at: '2024-04-14T16:39:57.000Z',
    community_member_id: 0000000,
    community_id: 00000,
    access_token: 'access_token',
    access_token_expires_at: '2024-03-20T16:54:47.274Z'
}
```

***

## getMemberAPITokenFromEmail

This function obtains a member `access_token` and `refresh_token` based on the community member's Email.&#x20;

### Request

```
const response = await client.getMemberAPITokenFromEmail(email@community.com)
```

### Accepted parameters

`email` - The Community Member Email. <mark style="color:red;">Required</mark>

### Response

```json5
{
    refresh_token: 'refresh_token',
    refresh_token_expires_at: '2024-04-14T16:39:57.000Z',
    community_member_id: 0000000,
    community_id: 00000,
    access_token: 'access_token',
    access_token_expires_at: '2024-03-20T16:54:47.274Z'
}
```

***

## getMemberAPITokenFromSSOId

This function obtains a member `access_token` and `refresh_token` based on the member's SSO (Single Sign-On) ID.

### Request

```javascript
const response = await client.getMemberAPITokenFromSSOId(SSOID);
```

### Accepted parameters

`SSOID` - The member ID that matches the one in your SSO. <mark style="color:red;">Required</mark>

### Response

```json5
{
    refresh_token: 'refresh_token',
    refresh_token_expires_at: '2024-04-14T16:39:57.000Z',
    community_member_id: 0000000,
    community_id: 00000,
    access_token: 'access_token',
    access_token_expires_at: '2024-03-20T16:54:47.274Z'
}
```

***

## getMemberAPITokenFromRefreshToken

This function obtains a new member `access_token` by providing the member's `refresh_token`. A new token can be generated once the current one is expired.

### Request

```javascript
const response = await client.getMemberAPITokenFromRefreshToken(refreshToken);
```

### Accepted parameters

`refreshToken` - the refresh token received from [`getMemberAPITokenFromSSOId`](#getmemberapitokenfromssoid). <mark style="color:red;">Required</mark>

### Response

```json5
{
    access_token: "newAccessToken",
    access_token_expires_at: "2024-03-20T16:55:50.727Z"
}
```

***

## revokeRefreshToken

Revokes a member's `refresh_token`, making it unusable for generating new `access_token`.

### Request

```javascript
const response = await client.revokeRefreshToken(refreshToken);
```

### Accepted parameters

`refreshToken` - the refresh token to be revoked. <mark style="color:red;">Required</mark>

### Response

on a successful request

```json5
null
```

on a failed request

```json5
{
    success: false,
    message: "Message"
}
```

***

## revokeMemberAPIToken

Revokes a member's `access_token`, making it unusable for future authenticated requests.

### Request

```javascript
const response = await client.revokeMemberAPIToken(accessToken);
```

### Accepted parameters

`accessToken` - the member access token to be revoked. <mark style="color:red;">Required</mark>

### Response

on a successful request

```json5
null
```

on a failed request

```json5
{
    success: false,
    message: "Message"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api.circle.so/apis/headless/auth-sdk/node.js/methods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
