# OpenAIAuthenticationRequiredException

Exception thrown when an operation requires an authenticated ChatGPT session.

Class 

`IntelligenceX.OpenAI`

**Namespace**

`IntelligenceX.OpenAI`

**Assembly**

`IntelligenceX`

**Source**

[OpenAIAuthenticationRequiredException.cs:17](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/OpenAIAuthenticationRequiredException.cs#L17)

**Base**

`InvalidOperationException`

**Implements**

`ISerializable`

**Modifiers**

sealed

Exception thrown when an operation requires an authenticated ChatGPT session.

## Inheritance

- InvalidOperationException
- OpenAIAuthenticationRequiredException

Filter members 

Show inherited

## Constructors

OpenAIAuthenticationRequiredException 3 overloads

`public OpenAIAuthenticationRequiredException()` [#](#constructor-ctor)

[OpenAIAuthenticationRequiredException.cs:17](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/OpenAIAuthenticationRequiredException.cs#L17)

Initializes a new instance with the default message.

`public OpenAIAuthenticationRequiredException(string message)` [#](#constructor-ctor-string)

[OpenAIAuthenticationRequiredException.cs:22](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/OpenAIAuthenticationRequiredException.cs#L22)

Initializes a new instance with a custom message.

Parameters

**message string required**

`public OpenAIAuthenticationRequiredException(string message, Exception innerException)` [#](#constructor-ctor-string-exception)

[OpenAIAuthenticationRequiredException.cs:27](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/OpenAIAuthenticationRequiredException.cs#L27)

Initializes a new instance with a custom message and inner exception.

Parameters

**message string required**

**innerException System.Exception required**

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual Exception GetBaseException()` [#](#method-getbaseexception)

Inherited from Exception

Returns

`Exception`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public virtual void GetObjectData(SerializationInfo info, StreamingContext context)` [#](#method-getobjectdata-serializationinfo-streamingcontext)

Inherited from Exception

`Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")` `EditorBrowsable(1)`

Parameters

**info SerializationInfo required**

**context StreamingContext required**

`public Type GetType()` [#](#method-gettype)

Inherited from Exception

Returns

`Type`

`public override string ToString()` [#](#method-tostring)

Inherited from Exception

Returns

`string`

## Inherited Properties

`public MethodBase? TargetSite { get; }` [#](#property-targetsite)

Inherited from Exception

`public virtual string Message { get; }` [#](#property-message)

Inherited from Exception

`public virtual IDictionary Data { get; }` [#](#property-data)

Inherited from Exception

`public Exception? InnerException { get; }` [#](#property-innerexception)

Inherited from Exception

`public virtual string? HelpLink { get; set; }` [#](#property-helplink)

Inherited from Exception

`public virtual string? Source { get; set; }` [#](#property-source)

Inherited from Exception

`public int HResult { get; set; }` [#](#property-hresult)

Inherited from Exception

`public virtual string? StackTrace { get; }` [#](#property-stacktrace)

Inherited from Exception

## Fields

`public const string DefaultMessage` [#](#field-defaultmessage)

[OpenAIAuthenticationRequiredException.cs:12](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/OpenAIAuthenticationRequiredException.cs#L12)

Default error message used when authentication is missing.

Value: `Not logged in. Run ChatGPT login first.`

<!-- PowerForge markdown artifact sha256:9C23E2F2E67597CC845B7527EAADA62AEAAFF4BDC8CA50920A86E0A9DD25D3E9 -->
