NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Interface CredentialsInterface

Provides access to the AWS credentials used for accessing AWS services: AWS access key ID, secret access key, and security token. These credentials are used to securely sign requests to AWS services.

  Aws\Common\Credentials\CredentialsInterface implements Serializable

### Direct known implementers

`Aws\Common\Credentials\AbstractCredentialsDecorator`, `Aws\Common\Credentials\Credentials`, `Aws\Common\Credentials\NullCredentials`

### Indirect known implementers

`Aws\Common\Credentials\AbstractRefreshableCredentials`, `Aws\Common\Credentials\CacheableCredentials`, `Aws\Common\Credentials\RefreshableInstanceProfileCredentials`

Namespace: Aws\Common\Credentials
Located at Aws/Common/Credentials/CredentialsInterface.php

## Methods summary

- `public` `getAccessKeyId ( )`

  Returns the AWS access key ID for this credentials object.

- `public` `getSecretKey ( )`

  Returns the AWS secret access key for this credentials object.

- `public` `getSecurityToken ( )`

  Get the associated security token if available

- `public` `getExpiration ( )`

  Get the UNIX timestamp in which the credentials will expire

- `public` `setAccessKeyId ( string $key )`

  Set the AWS access key ID for this credentials object.

- `public` `setSecretKey ( string $secret )`

  Set the AWS secret access key for this credentials object.

- `public` `setSecurityToken ( string $token )`

  Set the security token to use with this credentials object

- `public` `setExpiration ( int $timestamp )`

  Set the UNIX timestamp in which the credentials will expire

- `public` `isExpired ( )`

  Check if the credentials are expired

## Methods detail

# `public string`
`getAccessKeyId( )`

Returns the AWS access key ID for this credentials object.

#### Returns

`string`
# `public string`
`getSecretKey( )`

Returns the AWS secret access key for this credentials object.

#### Returns

`string`
# `public string|null`
`getSecurityToken( )`

Get the associated security token if available

#### Returns

`string|null`
# `public integer|null`
`getExpiration( )`

Get the UNIX timestamp in which the credentials will expire

#### Returns

`integer|null`
# `public `Aws\Common\Credentials\CredentialsInterface``
`setAccessKeyId( string $key )`

Set the AWS access key ID for this credentials object.

#### Parameters

$key
  `string`
  $key AWS access key ID

#### Returns

``Aws\Common\Credentials\CredentialsInterface``
# `public `Aws\Common\Credentials\CredentialsInterface``
`setSecretKey( string $secret )`

Set the AWS secret access key for this credentials object.

#### Parameters

$secret
  `string`
  $secret AWS secret access key

#### Returns

``Aws\Common\Credentials\CredentialsInterface``
# `public `Aws\Common\Credentials\CredentialsInterface``
`setSecurityToken( string $token )`

Set the security token to use with this credentials object

#### Parameters

$token
  `string`
  $token Security token

#### Returns

``Aws\Common\Credentials\CredentialsInterface``
# `public `Aws\Common\Credentials\CredentialsInterface``
`setExpiration( integer $timestamp )`

Set the UNIX timestamp in which the credentials will expire

#### Parameters

$timestamp
  `integer`
  $timestamp UNIX timestamp expiration

#### Returns

``Aws\Common\Credentials\CredentialsInterface``
# `public boolean`
`isExpired( )`

Check if the credentials are expired

#### Returns

`boolean`

### Methods inherited from Serializable

`serialize()`, `unserialize()`

### Magic methods summary