# Passing encypted password inside WebUI.authenticate

**URL:** <https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [December 20, 2018, 1:51pm UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807 "2018-12-20T13:51:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![M2018](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@M2018](https://forum.katalon.com/u/M2018)\
**Post date:** [December 20, 2018, 1:51pm UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/1 "2018-12-20T13:51:31Z")

</div>

I am using the method below to access my URL. I have to use this method as I am required to authenticate to this URL.

WebUI.authenticate(GlobalVariable.my\_url, ‘MJones’,‘mypassword123’, 10)

I want to provide the password in encrypted form. I have used the “Encrypt Text” feature within the Katalon Help menu and obtained an encrypted string but I cannot use this string with the method above.

The authentication box is the generic box that firefox and chrome presents to the user and so is not an object of my webpage.

Surely it must be possible to provide the password within the WebUI.authenticate method in encrypted form?

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [December 20, 2018, 4:12pm UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/2 "2018-12-20T16:12:32Z")

</div>

Hello,

actually, if you use Basic authentication, credentials are not encrypted, but encoded (using Base64). So it is very easy to decode it. I can show you a sample code, but IMO it is redundant.

Edit: Working code:

```
String encPwd = "a2F0YWxvbjpzdHVkaW8="
String decPwd = new String(Base64.getDecoder().decode(encPwd))

String url = "https://" + decPwd + "@httpbin.org/basic-auth/katalon/studio"

WebUI.openBrowser(url)
```

---

<div class="post-metadata">

**Author:** ![M2018](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@M2018](https://forum.katalon.com/u/M2018)\
**Post date:** [December 21, 2018, 8:49am UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/3 "2018-12-21T08:49:49Z")

</div>

Thanks for the reply Marek, it is appreciated.

Best wishes, Martin

---

<div class="post-metadata">

**Author:** ![discover.selenium](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/discover.selenium/32/522_2.png) [@discover.selenium](https://forum.katalon.com/u/discover.selenium)\
**Post date:** [December 21, 2018, 8:32pm UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/4 "2018-12-21T20:32:17Z")

</div>

> [@M2018](#):
>
> Marek

Hi Marek,

Thanks … But how to hide or encrypt the password in Katalon HTML report.

01:58:17.493 PASSED Browser is opened with url: **‘[https://katalon:studio@httpbin.org/basic-auth/katalon/studio](https://katalon:studio@httpbin.org/basic-auth/katalon/studio)’**

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [December 22, 2018, 10:51am UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/5 "2018-12-22T10:51:44Z")

</div>

Once again - the credentials are **encoded** , not **encrypted**. Even if you had your password encrypted, you’d have to decrypt it at some point prior to using it in your Basic auth.

Encoded form can be easily decoded without knowing or having anything else.

---

<div class="post-metadata">

**Author:** ![discover.selenium](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/discover.selenium/32/522_2.png) [@discover.selenium](https://forum.katalon.com/u/discover.selenium)\
**Post date:** [December 22, 2018, 9:07pm UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/6 "2018-12-22T21:07:49Z")

</div>

Hi Marek, How to hide the user name and password in the reports and log file.

 ![Log](https://europe1.discourse-cdn.com/katalon/original/1X/6ffd6bbced8e56f10dc35e8d49988dab28862195.png)

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [December 23, 2018, 9:43am UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/7 "2018-12-23T09:43:59Z")

</div>

Extract the code into a custom method.

```
public static void login() {
	String encPwd = "a2F0YWxvbjpzdHVkaW8="
	String decPwd = new String(Base64.getDecoder().decode(encPwd))
	
	String url = "https://" + decPwd + "@httpbin.org/basic-auth/katalon/studio"

	// this is logged
	WebUI.openBrowser('')
    // this is not
	DriverFactory.getWebDriver().navigate().to(url)
}

```

And call it in your test case.

 ![20181223-104325](https://europe1.discourse-cdn.com/katalon/original/1X/f29cfe29477a44de694af8bf1e9e38797fb77324.jpeg)

---

<div class="post-metadata">

**Author:** ![discover.selenium](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/discover.selenium/32/522_2.png) [@discover.selenium](https://forum.katalon.com/u/discover.selenium)\
**Post date:** [December 24, 2018, 10:33am UTC](https://forum.katalon.com/t/passing-encypted-password-inside-webui-authenticate/15807/8 "2018-12-24T10:33:42Z")

</div>

Thanks Marek …😉 Appreciate it.
