def register_token_credential_hooks(
        authorization_server, session, model_class):
    """Register token credential related hooks to authorization server.

    :param authorization_server: AuthorizationServer instance
    :param session: SQLAlchemy session
    :param model_class: TokenCredential class
    """
    def create_token_credential(token, temporary_credential):
        item = model_class(
            oauth_token=token['oauth_token'],
            oauth_token_secret=token['oauth_token_secret'],
            client_id=temporary_credential.get_client_id()
        )
        item.set_user_id(temporary_credential.get_user_id())
        session.add(item)
        session.commit()
        return item

    authorization_server.register_hook(
        'create_token_credential', create_token_credential)