---
title: "Oauth"
description: "Oauth"
url: "https://www.contentstack.com/docs/developers/sdks/marketplace-sdk/javascript/reference/oauth"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-20"
---

# Oauth

## Oauth

Contentstack OAuth allows users to share protected data from the Contentstack API without sharing the credentials. To do this, the Contentstack OAuth server issues access tokens (App and User tokens) that client applications can use to access restricted data on behalf of the user.

**Example:**

```
import * as contentstack from '@contentstack/marketplace-sdk'const client = contentstack.client({ authtoken: 'TOKEN'});client.marketplace('organization_uid').app('manifest_uid').oauth();
```

## fetch

The fetch method retrieves the authentication details of the app.

```
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').oauth().fetch()
.then((oAuthConfig) => console.log(oAuthConfig));
```

## update

The update method updates the OAuth details i.e., the redirect url and permission scope of an app.

```
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
const config = {
 redirect_uri: 'REDIRECT_URI',
 app_token_config: {
   enabled: true,
   scopes: ['scope1', 'scope2']
  },
  user_token_config: {
   enabled: true,
   scopes: ['scope1', 'scope2']
  }
 };
client.marketplace('organization_uid').app('manifest_uid').oauth().update({ config })
.then((oAuthConfig) => console.log(oAuthConfig));
```

## getScopes

The getScopes method is used to retrieve all permission scopes.

```
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').oauth().getScopes()
.then((scopes) => console.log(scopes));
```

## Oauth | JavaScript Marketplace SDK | Contentstack

Oauth handles OAuth authentication flows for apps in the Contentstack JavaScript Marketplace SDK.