# Module auth

### Classes

- AuthManager

### Functions

- getAccessTokenForSasjs
- getAccessTokenForViya
- getAuthCodeForSasjs
- getTokens
- isAuthorizeFormRequired
- isLogInRequired
- isLoggedInSASVIYA
- openWebPage
- refreshTokensForSasjs
- refreshTokensForViya
- verifySas9Login
- verifySasViyaLogin

## Functions

### getAccessTokenForSasjs

- getAccessTokenForSasjs(requestClient: RequestClient, clientId: string, authCode: string): Promise<object>

- - Defined in src/auth/getAccessTokenForSasjs.ts:10

  Exchanges the auth code for an access token for the given client.

  #### Parameters

  - ##### requestClient: RequestClient

    the pre-configured HTTP request client

  - ##### clientId: string

    the client ID to authenticate with.

  - ##### authCode: string

    the auth code received from the server.

  #### Returns Promise<object>

### getAccessTokenForViya

- getAccessTokenForViya(requestClient: RequestClient, clientId: string, clientSecret: string, authCode: string): Promise<SasAuthResponse>

- - Defined in src/auth/getAccessTokenForViya.ts:13

  Exchanges the auth code for an access token for the given client.

  #### Parameters

  - ##### requestClient: RequestClient

    the pre-configured HTTP request client

  - ##### clientId: string

    the client ID to authenticate with.

  - ##### clientSecret: string

    the client secret to authenticate with.

  - ##### authCode: string

    the auth code received from the server.

  #### Returns Promise<SasAuthResponse>

### Const getAuthCodeForSasjs

- getAuthCodeForSasjs(requestClient: RequestClient, username: string, password: string, clientId: string): Promise<string>

- - Defined in src/auth/getAuthCodeForSasjs.ts:11

  Performs a login authenticate and returns an auth code for the given client.

  #### Parameters

  - ##### requestClient: RequestClient

    the pre-configured HTTP request client

  - ##### username: string

    a string representing the username.

  - ##### password: string

    a string representing the password.

  - ##### clientId: string

    the client ID to authenticate with.

  #### Returns Promise<string>

### getTokens

- getTokens(requestClient: RequestClient, authConfig: AuthConfig, serverType?: ServerType): Promise<AuthConfig>

- - Defined in src/auth/getTokens.ts:17

  Returns the auth configuration, refreshing the tokens if necessary.

  #### Parameters

  - ##### requestClient: RequestClient

    the pre-configured HTTP request client

  - ##### authConfig: AuthConfig

    an object containing a client ID, secret, access token and refresh token

  - ##### Default value serverType: ServerType = ServerType.SasViya

    server type for which refreshing the tokens, defaults to SASVIYA

  #### Returns Promise<AuthConfig>

### Const isAuthorizeFormRequired

- isAuthorizeFormRequired(response: string): boolean

- - Defined in src/auth/isAuthorizeFormRequired.ts:1

  #### Parameters

  - ##### response: string

  #### Returns boolean

### Const isLogInRequired

- isLogInRequired(response: string): boolean

- - Defined in src/auth/isLoginRequired.ts:1

  #### Parameters

  - ##### response: string

  #### Returns boolean

### Const isLoggedInSASVIYA

- isLoggedInSASVIYA(): boolean

- - Defined in src/auth/verifySasViyaLogin.ts:32

  #### Returns boolean

### openWebPage

- openWebPage(url: string, windowName?: string, WindowFeatures?: WindowFeatures, onLoggedOut?: undefined | function): Promise<Window | null>

- - Defined in src/auth/openWebPage.ts:10

  #### Parameters

  - ##### url: string

  - ##### Default value windowName: string = ""

  - ##### Default value WindowFeatures: WindowFeatures = defaultWindowFeatures

  - ##### Optional onLoggedOut: undefined | function

  #### Returns Promise<Window | null>

### refreshTokensForSasjs

- refreshTokensForSasjs(requestClient: RequestClient, refreshToken: string): Promise<object>

- - Defined in src/auth/refreshTokensForSasjs.ts:9

  Exchanges the refresh token for an access token for the given client.

  #### Parameters

  - ##### requestClient: RequestClient

    the pre-configured HTTP request client

  - ##### refreshToken: string

    the refresh token received from the server.

  #### Returns Promise<object>

### refreshTokensForViya

- refreshTokensForViya(requestClient: RequestClient, clientId: string, clientSecret: string, refreshToken: string): Promise<SasAuthResponse>

- - Defined in src/auth/refreshTokensForViya.ts:13

  Exchanges the refresh token for an access token for the given client.

  #### Parameters

  - ##### requestClient: RequestClient

    the pre-configured HTTP request client

  - ##### clientId: string

    the client ID to authenticate with.

  - ##### clientSecret: string

    the client secret to authenticate with.

  - ##### refreshToken: string

    the refresh token received from the server.

  #### Returns Promise<SasAuthResponse>

### verifySas9Login

- verifySas9Login(loginPopup: Window): Promise<object>

- - Defined in src/auth/verifySas9Login.ts:3

  #### Parameters

  - ##### loginPopup: Window

  #### Returns Promise<object>

### verifySasViyaLogin

- verifySasViyaLogin(loginPopup: Window): Promise<object>

- - Defined in src/auth/verifySasViyaLogin.ts:3

  #### Parameters

  - ##### loginPopup: Window

  #### Returns Promise<object>

Generated using TypeDoc