| @@ -59,13 +59,17 @@ | ||
| 59 | 59 | ); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $url = sprintf( |
| 63 | - 'https://api.awin.com/publishers/%1$s/programmes?relationship=joined&accessToken=%2$s', | |
| 64 | - $affiliate_id, $awin_access_token | |
| 63 | + 'https://api.awin.com/publishers/%1$s/programmes?relationship=joined', | |
| 64 | + rawurlencode( $affiliate_id ) | |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - $response = wp_remote_get( $url, [ 'timeout' => 15 ] ); | |
| 67 | + // Send the token in a header so it isn't written to proxy and server access logs. | |
| 68 | + $response = wp_remote_get( $url, [ | |
| 69 | + 'timeout' => 15, | |
| 70 | + 'headers' => [ 'Authorization' => 'Bearer ' . $awin_access_token ], | |
| 71 | + ] ); | |
| 68 | 72 | $code = (int) wp_remote_retrieve_response_code( $response ); |
| 69 | 73 | |
| 70 | 74 | if ( ! is_wp_error( $response ) && 200 === $code ) { |
| 71 | 75 | $programs = json_decode( wp_remote_retrieve_body( $response ), true ); |