def METHOD_NAME(config):
    config = config.get("credentials") or config
    credentials_base64_encoded = standard_b64encode(
        (config.get("client_id") + ":" + config.get("client_secret")).encode("ascii")
    ).decode("ascii")
    auth = f"Basic {credentials_base64_encoded}"
    return Oauth2Authenticator(
        token_refresh_endpoint=f"{PinterestStream.url_base}oauth/token",
        client_secret=config.get("client_secret"),
        client_id=config.get("client_id"),
        refresh_access_token_headers={"Authorization": auth},
        refresh_token=config.get("refresh_token"),
    )