Are you sure you have authentication enabled on your cassandra cluster?
Modified with logging:
```
diff --git a/examples/auth/auth.c b/examples/auth/auth.c
index 7cc8491e..7a0880f1 100644
--- a/examples/auth/auth.c
+++ b/examples/auth/auth.c
@@ -65,6 +65,8 @@ void on_auth_initial(CassAuthenticator* auth, void* data) {
response[username_size + 1] = '\0';
memcpy(response + username_size + 2, credentials->password, password_size);
+
+ printf("Auth initialization\n");
}
void on_auth_challenge(CassAuthenticator* auth, void* data, const char* token, size_t token_size) {
@@ -72,6 +74,7 @@ void on_auth_challenge(CassAuthenticator* auth, void* data, const char* token, s
* Not used for plain text authentication, but this is to be used
* for handling an authentication challenge initiated by the server.
*/
+ printf("Auth challenge\n");
}
void on_auth_success(CassAuthenticator* auth, void* data, const char* token, size_t token_size) {
@@ -79,6 +82,7 @@ void on_auth_success(CassAuthenticator* auth, void* data, const char* token, siz
* Not used for plain text authentication, but this is to be used
* for handling the success phase of an exchange.
*/
+ printf("Auth success\n");
}
void on_auth_cleanup(CassAuthenticator* auth, void* data) {
@@ -87,6 +91,7 @@ void on_auth_cleanup(CassAuthenticator* auth, void* data) {
* this is used to cleanup resources acquired during the authentication
* exchange.
*/
+ printf("Auth cleanup\n");
}
int main(int argc, char* argv[]) {
```
Output:
```
$ ./examples/auth/auth
Auth initialization
Auth success
Auth cleanup
Auth initialization
Auth success
Successfully connected!
Auth cleanup
```