'Exchange an [OAuth 2.0](http://oauth.net/2/) authorization code
or refresh token (from [/api/v1/authorize](#api_method_authorize)) for
an access token.
On success, returns a URL-encoded dictionary containing
**access_token**, **token_type**, **expires_in**, and **scope**.
If an authorization code for a permanent grant was given, a
**refresh_token** will be included. If there is a problem, an **error**
parameter will be returned instead.
Must be called using SSL, and must contain a HTTP `Authorization:`
header which contains the application\'s client identifier as the
username and client secret as the password.  (The client id and secret
are visible on the [app preferences page](/prefs/apps).)
Per the OAuth specification, **grant_type** must be one of:
* ``authorization_code`` for the initial access token ("standard" OAuth2 flow)
* ``refresh_token`` for renewing the access token.
* ``password`` for script-type apps using password auth
* ``client_credentials`` for application-only (signed out) access - confidential clients
* ``https://oauth.reddit.com/grants/installed_client`` extension grant for application-only (signed out)
access - non-confidential (installed) clients
**redirect_uri** must exactly match the value that was used in the call
to [/api/v1/authorize](#api_method_authorize) that created this grant.
See reddit\'s [OAuth2 wiki](https://github.com/reddit/reddit/wiki/OAuth2) for
more information.'

@validate(grant_type=VOneOf('grant_type', ('authorization_code', 'refresh_token', 'password', 'client_credentials', 'https://oauth.reddit.com/grants/installed_client')))
def POST_access_token(self, grant_type):

    self.OPTIONS_access_token()
    if (grant_type == 'authorization_code'):
        return self._access_token_code()
    elif (grant_type == 'refresh_token'):
        return self._access_token_refresh()
    elif (grant_type == 'password'):
        return self._access_token_password()
    elif (grant_type == 'client_credentials'):
        return self._access_token_client_credentials()
    elif (grant_type == 'https://oauth.reddit.com/grants/installed_client'):
        return self._access_token_extension_client_credentials()
    else:
        resp = {'error': 'unsupported_grant_type'}
        return self.api_wrapper(resp)
