import requests


def offline_token_using_password(token_endpoint, client_id, username,
                                 password):
    """Get offine token using password."""
    response = requests.post(
        token_endpoint,
        data={
            'grant_type': 'password',
            'scope': ['offline_access', 'openid'],
            'client_id': client_id,
            'username': username,
            'password': password,
        })
    return response.json()