# OAuthResponseText

## Overview

The `OAuthResponseText` object is used for handling text-based responses during OAuth authentication. It provides methods to retrieve the response body, HTTP status code, and headers, making it easier to process and evaluate the OAuth service's responses.

The `getBody()` method returns the response body as a string, offering direct access to the textual content. The `getCode()` method retrieves the HTTP response code, represented as a number, to assess the success or failure of the request. For header management, the `getHeader(name)` method fetches a specific header's value based on its name, while the `getHeaders()` method provides an array containing all response headers.

For more information about authentication using the OAuth service, refer to the [OAuth Provider](https://docs.servoy.com/guides/develop/security/authentication#oauth-provider) from the [Authentication](ttps://docs.servoy.com/guides/develop/security/authentication) section of this documentation.

## Methods Summarized

| Type                                                     | Name                               | Summary |
| -------------------------------------------------------- | ---------------------------------- | ------- |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [getBody()](#getbody)              |         |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [getCode()](#getcode)              |         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [getHeader(name)](#getheader-name) |         |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)   | [getHeaders()](#getheaders)        |         |

## Methods Detailed

### getBody()

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The response body as a string, or null if an error occurs while reading it.

### getCode()

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) The HTTP status code of the OAuth response.

### getHeader(name)

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** ;

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The value of the specified header, or null if the header is not present.

### getHeaders()

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) An array of all header names in the OAuth response.

***


---

# Agent Instructions: 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:

```
GET https://docs.servoy.com/reference/servoyextensions/server-plugins/oauth/oauthresponsetext.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
