Created
          January 21, 2020 17:33 
        
      - 
      
 - 
        
Save SZharkov/6fbc979848fd344ffd23ef6b4c4d28f3 to your computer and use it in GitHub Desktop.  
    Basic authentication with fetch
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Node | |
| headers.set('Authorization', 'Basic ' + Buffer.from(username + ":" + password).toString('base64')); | |
| // Browser | |
| headers.set('Authorization', 'Basic ' + btoa(username + ":" + password)); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment