Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

HTML SDK - Password persistency w/out Widgets

Coxta45
11 - Bolide

I'm working on building a new version of the JIRA connector using the HTML/JavaScript SDK.  I've run into an issue with persistency on a SimpleString password data-item.  While the widgets are fine, I'm a web developer at heart and am enjoying being able to use a light build of my favorite front-end framework to design the UI for the connector (having this capability is by far my favorite part of the new SDK at this point).

 

Ok, so here is the problem.  Without using the widgets, you can't make use of the nifty bindDataItemToWidget function within the manager class...which means you're responsible for handling the data persistency between the XML config and the UI on your own.  This only causing me issues when I'm handling a SimpleString of the password type.  Without specifying the data type as password, the persistency is a piece of cake.  However, the password is stored in plain sight, unencrypted, right there in the XML.  If I do specify the SimpleString as a password, then I lose the password on it's way back to the UI (Alteryx.Gui.AfterLoad) from it's encrypted format in the XML.  I feel like I am missing something...Is the password encryption one way?  Is there a decryption helper function that I'm missing?  Here's what I've got so far...

 

HTML Markup (input fields)

<!-- Site URL -->
<div class="field">
  <label for="siteUrl">Site URL</label>
  <input placeholder="https://example.atlassian.net" id="siteUrl" name="siteUrl" type="text">
</div>

<!-- Username or Email -->
<div class="field">
  <label for="userName">Username or Email</label>
  <input placeholder="your.username" id="userName" name="userName" type="text">
</div>

<!-- Password -->
<div class="field">
  <label for="userPass">Password</label>
  <input placeholder="your password" id="userPass" name="userPass" type="password">
</div>

JavaScript (BeforeLoad, AfterLoad functions)

Alteryx.Gui.BeforeLoad = function (manager, AlteryxDataItems, json) {

	// JIRA Site URL
	var siteUrl = new AlteryxDataItems.SimpleString('siteUrl')
 	manager.addDataItem(siteUrl)
	document.getElementById('siteUrl').onkeyup = function (siteurl) {
		siteUrl.setValue(siteurl.target.value)
	}

	// Username
	var userName = new AlteryxDataItems.SimpleString('userName')
 	manager.addDataItem(userName)
	document.getElementById('userName').onkeyup = function (username) {
		userName.setValue(username.target.value)
	}

	// Password ... Is this one way encryption???
	var userPass = new AlteryxDataItems.SimpleString('userPass', {password: true})
 	manager.addDataItem(userPass)
	document.getElementById('userPass').onkeyup = function (userpass) {
		userPass.setValue(userpass.target.value)
	}

}

Alteryx.Gui.AfterLoad = function (manager, AlteryxDataItems) {

	var siteUrl = manager.getDataItem('siteUrl')
	var userName = manager.getDataItem('userName')
	var userPass = manager.getDataItem('userPass')

	document.getElementById('siteUrl').value = siteUrl.getValue()
	document.getElementById('userName').value = userName.getValue()
	document.getElementById('userPass').value = userPass.getValue()
        // userPass.getValue() returns empty string, others return their respective values
}

Anyone have any ideas? @jdunkerley79, I've been following your blog and you seem to know your way around the SDK as well as anyone at this point...any chance you have any advice here?

 

Regards,

 

Taylor Cox

 

15 REPLIES 15
Coxta45
11 - Bolide

@RyanSw - ooohhhhhh, now I get it.  And yes, that is exactly what I'm trying to acheive.  Many thanks (again)

 

OooohhhhhOooohhhhh

TashaA
Alteryx Alumni (Retired)

Thanks for the heads up @jdunkerley79, working with the community team to see what we can do about getting some attachments enabled!

TashaA
Alteryx Alumni (Retired)

Thanks for the recommendation @Coxta45@LeahK and I will update you once we have a path forward for attachments in this forum. 

Coxta45
11 - Bolide

I just realized...I beleive the thread creator can attach files, just not enabled for repliers.

LeahK
Alteryx Alumni (Retired)

@Coxta45 & @jdunkerley79,

 

re: file types on dev forum -- I threw the question out to the Community: Developer forum - file type attachments?

 

Please reply with what you'd like to see, and hopefully others will chime in as well.

jdunkerley79
ACE Emeritus
ACE Emeritus
Thanks added my two cents.