public static String loadAppSecret(String secretFile)
    {
        JsonCodec<Map<String, String>> codec = JsonCodec.mapJsonCodec(String.class, String.class);

        final Map<String, String> content;
        try {
            byte[] bytes = Files.readAllBytes(Paths.get(secretFile));
            content = codec.fromBytes(bytes);
        }
        catch (Exception e) {
            throw new IllegalArgumentException("Could not read secret file " + secretFile, e);
        }

        String secret = content.get("app-secret");
        if (emptyToNull(secret) == null) {
            throw new IllegalArgumentException("app-secret not provided in " + secretFile);
        }
        return secret;
    }
@Test
    public void testLoadAppSecret()
    {
        final String appSecret = "faking_app_secret";

        // create a secret file
        final Path secretFilePath;
        try {
            secretFilePath = Files.createTempFile("app-secret-", ".json");
            JsonCodec<Map<String, String>> jsonCodec = JsonCodec.mapJsonCodec(String.class, String.class);
            byte[] bytes = jsonCodec.toBytes(ImmutableMap.of("app-secret", appSecret));
            Files.write(secretFilePath, bytes);
        }
        catch (IOException e) {
            fail("Cannot create a secret file", e);
            throw new UncheckedIOException(e);
        }

        // test loadAppSecret
        String loadedAppSecret = LarkSheetsUtil.loadAppSecret(secretFilePath.toString());
        assertEquals(loadedAppSecret, appSecret);
    }