OAuthInput class

OAuthInput prompts user to login.

Extends

Constructors

OAuthInput(string, string, string, number)

Initializes a new instance of the OAuthInput class

Properties

$kind
connectionName

Name of the OAuth connection being used.

text

(Optional) additional text to include on the signin card.

timeout

(Optional) number of milliseconds the prompt will wait for the user to authenticate. Defaults to a value 900,000 (15 minutes.)

title

Title of the cards signin button.

Inherited Properties

allowInterruptions

Interruption policy.

alwaysPrompt

A value indicating whether the input should always prompt the user regardless of there being a value or not.

defaultValue

The default value for the input dialog when maxTurnCount is exceeded.

defaultValueResponse

The activity template to send when maxTurnCount has be reached and the default value is used.

disabled

An optional expression which if is true will disable this action.

EndOfTurn

Gets a default end-of-turn result.

id
invalidPrompt

The activity template to send to the user whenever the value provided is invalid or not.

maxTurnCount

Maximum number of times to ask the user for this value before the dialog gives up.

OPTIONS_PROPERTY
prompt

The activity to send to the user.

property

The value expression which the input will be bound to.

telemetryClient
TURN_COUNT_PROPERTY
unrecognizedPrompt

The activity template for retrying prompt.

validations

The expressions to run to validate the input.

value

A value expression which can be used to initialize the input prompt.

VALUE_PROPERTY

Methods

beginDialog(DialogContext, PromptOptions)

Called when a prompt Dialog is pushed onto the dialog stack and is being activated.

continueDialog(DialogContext)

Called when a prompt Dialog is the active dialog and the user replied with a new activity.

getConverter(Object)
getUserToken(DialogContext, string)

Attempts to retrieve the stored token for the current user.

signOutUser(DialogContext)

Signs the user out of the service.

Inherited Methods

configure(Record<string, unknown>)

Fluent method for configuring the object.

endDialog(TurnContext, DialogInstance, DialogReason)

When overridden in a derived class, performs clean up for the dialog before it ends.

getVersion()

An encoded string used to aid in the detection of bot changes on re-deployment.

onDialogEvent(DialogContext, DialogEvent)

Called when an event has been raised, using DialogContext.emitEvent(), by either the current dialog or a dialog that the current dialog started.

repromptDialog(TurnContext, DialogInstance)

When overridden in a derived class, reprompts the user for input.

resumeDialog(DialogContext, DialogReason, any)

Called when a child Dialog completes its turn, returning control to this dialog.

Constructor Details

OAuthInput(string, string, string, number)

Initializes a new instance of the OAuthInput class

new OAuthInput(connectionName?: string, title?: string, text?: string, timeout?: number)

Parameters

connectionName

string

Optional. Name of the OAuth connection being used.

title

string

Optional. Title of the cards signin button.

text

string

Optional. Additional text to include on the signin card.

timeout

number

Optional. Number of milliseconds the prompt will wait for the user to authenticate.

Property Details

$kind

static $kind: string

Property Value

string

connectionName

Name of the OAuth connection being used.

connectionName: StringExpression

Property Value

StringExpression

text

(Optional) additional text to include on the signin card.

text?: StringExpression

Property Value

StringExpression

timeout

(Optional) number of milliseconds the prompt will wait for the user to authenticate. Defaults to a value 900,000 (15 minutes.)

timeout?: IntExpression

Property Value

IntExpression

title

Title of the cards signin button.

title: StringExpression

Property Value

StringExpression

Inherited Property Details

allowInterruptions

Interruption policy.

allowInterruptions: BoolExpression

Property Value

BoolExpression

Inherited From InputDialog.allowInterruptions

alwaysPrompt

A value indicating whether the input should always prompt the user regardless of there being a value or not.

alwaysPrompt: BoolExpression

Property Value

BoolExpression

Inherited From InputDialog.alwaysPrompt

defaultValue

The default value for the input dialog when maxTurnCount is exceeded.

defaultValue?: ValueExpression

Property Value

ValueExpression

Inherited From InputDialog.defaultValue

defaultValueResponse

The activity template to send when maxTurnCount has be reached and the default value is used.

defaultValueResponse: TemplateInterface<Partial<Activity>, DialogStateManager>

Property Value

TemplateInterface<Partial<Activity>, DialogStateManager>

Inherited From InputDialog.defaultValueResponse

disabled

An optional expression which if is true will disable this action.

disabled?: BoolExpression

Property Value

BoolExpression

Inherited From InputDialog.disabled

EndOfTurn

Gets a default end-of-turn result.

static EndOfTurn: DialogTurnResult

Property Value

DialogTurnResult

Remarks

This result indicates that a dialog (or a logical step within a dialog) has completed processing for the current turn, is still active, and is waiting for more input.

Inherited From Dialog.EndOfTurn

id

id: string

Property Value

string

Inherited From Dialog.id

invalidPrompt

The activity template to send to the user whenever the value provided is invalid or not.

invalidPrompt: TemplateInterface<Partial<Activity>, DialogStateManager>

Property Value

TemplateInterface<Partial<Activity>, DialogStateManager>

Inherited From InputDialog.invalidPrompt

maxTurnCount

Maximum number of times to ask the user for this value before the dialog gives up.

maxTurnCount?: IntExpression

Property Value

IntExpression

Inherited From InputDialog.maxTurnCount

OPTIONS_PROPERTY

static OPTIONS_PROPERTY: string

Property Value

string

Inherited From InputDialog.OPTIONS_PROPERTY

prompt

The activity to send to the user.

prompt: TemplateInterface<Partial<Activity>, DialogStateManager>

Property Value

TemplateInterface<Partial<Activity>, DialogStateManager>

Inherited From InputDialog.prompt

property

The value expression which the input will be bound to.

property: StringExpression

Property Value

StringExpression

Inherited From InputDialog.property

telemetryClient

telemetryClient: BotTelemetryClient

Property Value

BotTelemetryClient

Inherited From Dialog.telemetryClient

TURN_COUNT_PROPERTY

static TURN_COUNT_PROPERTY: string

Property Value

string

Inherited From InputDialog.TURN_COUNT_PROPERTY

unrecognizedPrompt

The activity template for retrying prompt.

unrecognizedPrompt: TemplateInterface<Partial<Activity>, DialogStateManager>

Property Value

TemplateInterface<Partial<Activity>, DialogStateManager>

Inherited From InputDialog.unrecognizedPrompt

validations

The expressions to run to validate the input.

validations: string[]

Property Value

string[]

Inherited From InputDialog.validations

value

A value expression which can be used to initialize the input prompt.

value: ValueExpression

Property Value

ValueExpression

Inherited From InputDialog.value

VALUE_PROPERTY

static VALUE_PROPERTY: string

Property Value

string

Inherited From InputDialog.VALUE_PROPERTY

Method Details

beginDialog(DialogContext, PromptOptions)

Called when a prompt Dialog is pushed onto the dialog stack and is being activated.

function beginDialog(dc: DialogContext, options?: PromptOptions): Promise<DialogTurnResult>

Parameters

dc

DialogContext

The DialogContext for the current turn of conversation.

options

PromptOptions

Optional. Additional information to pass to the prompt being started.

Returns

Promise<DialogTurnResult>

A DialogTurnResult Promise representing the asynchronous operation.

continueDialog(DialogContext)

Called when a prompt Dialog is the active dialog and the user replied with a new activity.

function continueDialog(dc: DialogContext): Promise<DialogTurnResult>

Parameters

dc

DialogContext

The DialogContext for the current turn of conversation.

Returns

Promise<DialogTurnResult>

A DialogTurnResult Promise representing the asynchronous operation.

getConverter(Object)

function getConverter(property: Object): Converter | ConverterFactory

Parameters

property

Object

The key of the conditional selector configuration.

Returns

Converter | ConverterFactory

The converter for the selector configuration.

getUserToken(DialogContext, string)

Attempts to retrieve the stored token for the current user.

function getUserToken(dc: DialogContext, code?: string): Promise<TokenResponse | undefined>

Parameters

dc

DialogContext

Context reference the user that's being looked up.

code

string

(Optional) login code received from the user.

Returns

Promise<TokenResponse | undefined>

A promise representing the asynchronous operation.

signOutUser(DialogContext)

Signs the user out of the service.

function signOutUser(dc: DialogContext): Promise<void>

Parameters

dc

DialogContext

Context referencing the user that's being signed out.

Returns

Promise<void>

A promise representing the asynchronous operation.

Remarks

This example shows creating an instance of the prompt and then signing out the user.

const prompt = new OAuthPrompt({
    connectionName: 'GitConnection',
    title: 'Login To GitHub'
});
await prompt.signOutUser(context);

Inherited Method Details

configure(Record<string, unknown>)

Fluent method for configuring the object.

function configure(config: Record<string, unknown>): this

Parameters

config

Record<string, unknown>

Configuration settings to apply.

Returns

this

The Configurable after the operation is complete.

Inherited From Configurable.configure

endDialog(TurnContext, DialogInstance, DialogReason)

When overridden in a derived class, performs clean up for the dialog before it ends.

function endDialog(_context: TurnContext, _instance: DialogInstance, _reason: DialogReason): Promise<void>

Parameters

_context

TurnContext

The context object for the turn.

_instance

DialogInstance

Current state information for this dialog.

_reason

DialogReason

The reason the dialog is ending.

Returns

Promise<void>

Remarks

Derived dialogs that need to perform logging or cleanup before ending should override this method. By default, this method has no effect.

The DialogContext calls this method when the current dialog is ending.

See also

Inherited From Dialog.endDialog

getVersion()

An encoded string used to aid in the detection of bot changes on re-deployment.

function getVersion(): string

Returns

string

Unique string which should only change when dialog has changed in a way that should restart the dialog.

Remarks

This defaults to returning the dialogs id but can be overridden to provide more precise change detection logic. Any dialog on the stack that has its version change will result in a versionChanged event will be raised. If this event is not handled by the bot, an error will be thrown resulting in the bots error handler logic being run.

Returning an empty string will disable version tracking for the component all together.

Inherited From Dialog.getVersion

onDialogEvent(DialogContext, DialogEvent)

Called when an event has been raised, using DialogContext.emitEvent(), by either the current dialog or a dialog that the current dialog started.

function onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean>

Parameters

dc

DialogContext

The dialog context for the current turn of conversation.

e

DialogEvent

The event being raised.

Returns

Promise<boolean>

True if the event is handled by the current dialog and bubbling should stop.

Inherited From Dialog.onDialogEvent

repromptDialog(TurnContext, DialogInstance)

When overridden in a derived class, reprompts the user for input.

function repromptDialog(_context: TurnContext, _instance: DialogInstance): Promise<void>

Parameters

_context

TurnContext

The context object for the turn.

_instance

DialogInstance

Current state information for this dialog.

Returns

Promise<void>

Remarks

Derived dialogs that support validation and re-prompt logic should override this method. By default, this method has no effect.

The DialogContext calls this method when the current dialog should re-request input from the user. This method is implemented for prompt dialogs.

See also

Inherited From Dialog.repromptDialog

resumeDialog(DialogContext, DialogReason, any)

Called when a child Dialog completes its turn, returning control to this dialog.

function resumeDialog(dc: DialogContext, _reason: DialogReason, _result?: any): Promise<DialogTurnResult>

Parameters

dc

DialogContext

The DialogContext for the current turn of conversation.

_reason

DialogReason

(xref:botbuilder-dialogs.DialogReason), reason why the dialog resumed.

_result

any

Optional. Value returned from the Dialog that was called. The type of the value returned is dependent on the child dialog.

Returns

Promise<DialogTurnResult>

A DialogTurnResult Promise representing the asynchronous operation.

Inherited From InputDialog.resumeDialog