A C library for interacting with the Authdog API.
- User information retrieval
- HTTP client with libcurl
- Memory management
- Error handling
- Cross-platform support
- libcurl (for HTTP requests)
- CMake 3.10+ (for building)
mkdir build
cd build
cmake ..
makemake test
# or
./test_authdog#include "authdog.h"
#include <stdio.h>
int main() {
// Create client configuration
authdog_config_t config = {
.base_url = "https://api.authdog.com",
.access_token = "your_access_token_here",
.api_key = NULL,
.timeout_ms = 10000
};
// Create client
authdog_client_t *client = authdog_client_create(&config);
if (!client) {
printf("Failed to create client\n");
return 1;
}
// Get user info
authdog_user_info_t *user_info = NULL;
authdog_error_t error = authdog_get_user_info(client, &user_info);
if (error == AUTHDOG_SUCCESS && user_info) {
printf("User ID: %s\n", user_info->id);
printf("Email: %s\n", user_info->email);
// Free user info
authdog_user_info_free(user_info);
} else {
printf("Error: %s\n", authdog_error_message(error));
}
// Clean up client
authdog_client_destroy(client);
return 0;
}authdog_client_create()- Create a new client instanceauthdog_client_destroy()- Destroy a client instanceauthdog_get_user_info()- Get user informationauthdog_user_info_free()- Free user info structureauthdog_error_message()- Get error message for error code
AUTHDOG_SUCCESS- SuccessAUTHDOG_ERROR_INVALID_PARAM- Invalid parameterAUTHDOG_ERROR_MEMORY_ALLOCATION- Memory allocation failedAUTHDOG_ERROR_NETWORK- Network errorAUTHDOG_ERROR_AUTHENTICATION- Authentication failedAUTHDOG_ERROR_SERVER- Server errorAUTHDOG_ERROR_UNKNOWN- Unknown error
See LICENSE file for details.