VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-urlobject-auth-api/

⇱ Node.js urlObject.auth API - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js urlObject.auth API

Last Updated : 11 Jul, 2025

With the help of urlObject.auth() method, we can find the authentication parameter within the hostname. This method returns the string of parameters.

Syntax :

urlObject.auth()  

Return: Returns the string of authentication parameters. 

Example 1: In this example with the help of urlObject.auth() method we are able to extract the username and password from the hostname.

Output: 

👁 Image

Example 2: In this example with the help of urlObject.auth() method we are able to extract the username and password from the hostname.

Output: 

👁 Image

Comment
Article Tags:

Explore