---
schema_version: "1"
id: 37daf2919661f36efabdb086f591e0c955912faf4e2b55224ac7623c2cd29d03
title: OAuthRefreshResult Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Auth_OAuthRefreshResult.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b0f1e5b56538238a248c90bf7d5f8c62c4ffdf5206916e52e0409d2114f2397d
description: Stores the result of an AuthProviderPluginClass refresh method. OAuth authentication flow provides a refresh token that can be used to get a new access token. Access tokens have a limited lifetime as specified by the session timeout value. When an access token expires, use a refresh token to get a new access token.Creates an instance of the OAuthRefreshResult class using the specified access token, refresh token, and error for a custom authentication provider plug-in.Creates an instance of the OAuthRefreshResult class using the specified access token and refresh token for a custom authentication provider plug-in. Use this method when you know that the refresh was successful. The OAuth access token for the user who is currently logged in. Error that occurs when a user unsuccessfully attempts to authenticate with the custom authentication provider.The OAuth refresh token for the user who is currently logged in.
---
# OAuthRefreshResult Class

Stores the result of an AuthProviderPluginClass refresh method. OAuth authentication flow provides a refresh token that can be used to get a new access token. Access tokens have a limited lifetime as specified by the session timeout value. When an access token expires, use a refresh token to get a new access token.

## Namespace

[Auth](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Auth.htm "The Auth namespace provides an interface and classes for single sign-on into Salesforce and session security management.")

## Usage

The OAuthRefreshResult class contains the parameters, accessToken, refreshToken, and error, all of which are of type string. For a code example, see .

- **[OAuthRefreshResult Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_constructors)**
- **[OAuthRefreshResult Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_properties)**

## OAuthRefreshResult Constructors

The following are constructors for OAuthRefreshResult.

- **[OAuthRefreshResult(accessToken, refreshToken, error)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_ctor)**  
    Creates an instance of the OAuthRefreshResult class using the specified access token, refresh token, and error for a custom authentication provider plug-in.
- **[OAuthRefreshResult(accessToken, refreshToken)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_ctor_2)**  
    Creates an instance of the OAuthRefreshResult class using the specified access token and refresh token for a custom authentication provider plug-in. Use this method when you know that the refresh was successful.

### OAuthRefreshResult(accessToken, refreshToken, error)

Creates an instance of the OAuthRefreshResult class using the specified access token, refresh token, and error for a custom authentication provider plug-in.

#### Signature

public OAuthRefreshResult(String accessToken, String refreshToken, String error)

#### Parameters

- **accessToken**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    OAuth access token
    
    for the user who is currently logged in.
- **refreshToken**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    OAuth refresh token
    
    for the user who is currently logged in.
- **error**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Error that occurred
    
    when a user attempted to authenticate with the custom authentication provider.

### OAuthRefreshResult(accessToken, refreshToken)

Creates an instance of the OAuthRefreshResult class using the specified access token and refresh token for a custom authentication provider plug-in. Use this method when you know that the refresh was successful.

#### Signature

public OAuthRefreshResult(String accessToken, String refreshToken)

#### Parameters

- **accessToken**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The OAuth access token for the user who is logged in.
- **refreshToken**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The OAuth refresh token for the user who is logged in.

## OAuthRefreshResult Properties

The following are properties for OAuthRefreshResult.

- **[accessToken](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_accessToken)**  
    The OAuth access token for the user who is currently logged in.
- **[error](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_error)**  
    Error that occurs when a user unsuccessfully attempts to authenticate with the custom authentication provider.
- **[refreshToken](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_OAuthRefreshResult.htm#apex_Auth_OAuthRefreshResult_refreshToken)**  
    The OAuth refresh token for the user who is currently logged in.

### accessToken

The OAuth access token for the user who is currently logged in.

#### Signature

public String accessToken {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### error

Error that occurs when a user unsuccessfully attempts to authenticate with the custom authentication provider.

#### Signature

public String error {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### refreshToken

The OAuth refresh token for the user who is currently logged in.

#### Signature

public String refreshToken {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")