@@ -177,6 +177,12 @@ void Polaris_SetLogLevel(int log_level) {
177177/******************************************************************************/
178178int Polaris_Authenticate (PolarisContext_t * context , const char * api_key ,
179179 const char * unique_id ) {
180+ return Polaris_AuthenticateTo (context , api_key , unique_id , POLARIS_API_URL );
181+ }
182+
183+ /******************************************************************************/
184+ int Polaris_AuthenticateTo (PolarisContext_t * context , const char * api_key ,
185+ const char * unique_id , const char * api_url ) {
180186 // Sanity check the inputs.
181187 if (strlen (api_key ) == 0 ) {
182188 P1_Print ("API key must not be empty.\n" );
@@ -210,16 +216,16 @@ int Polaris_Authenticate(PolarisContext_t* context, const char* api_key,
210216 return POLARIS_NOT_ENOUGH_SPACE ;
211217 }
212218
213- P1_DebugPrint ("Sending auth request. [api_key=%s, unique_id=%s]\n" , api_key ,
214- unique_id );
219+ P1_DebugPrint ("Sending auth request. [api_key=%s, unique_id=%s, url=%s ]\n" ,
220+ api_key , unique_id , api_url );
215221 context -> auth_token [0 ] = '\0' ;
216222#ifdef POLARIS_USE_TLS
217223 int status_code =
218- SendPOSTRequest (context , POLARIS_API_URL , 443 , "/api/v1/auth/token" ,
224+ SendPOSTRequest (context , api_url , 443 , "/api/v1/auth/token" ,
219225 context -> recv_buffer , (size_t )content_size );
220226#else
221227 int status_code =
222- SendPOSTRequest (context , POLARIS_API_URL , 80 , "/api/v1/auth/token" ,
228+ SendPOSTRequest (context , api_url , 80 , "/api/v1/auth/token" ,
223229 context -> recv_buffer , (size_t )content_size );
224230#endif
225231 if (status_code < 0 ) {
0 commit comments