swte

Basic Auth for Swift AI prebuild

Sep 28th, 2023 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. add_filter('http_request_args', function($r){
  2.     // Check if it is a prebuild request
  3.     if (isset($r['headers']['X-PREBUILD'])) {
  4.         $user = 'YOUR_USERNAME';
  5.         $password = 'YOUR_PASSWORD';
  6.         $r['headers']['Authorization'] = 'Basic ' . base64_encode( $user . ':' . $password );
  7.     }
  8.  
  9.     return $r;
  10. });
Add Comment
Please, Sign In to add comment