how to authenticate a remote instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 10:59 PM
Hi All,
I am creating a module in line with team development > remote instance.
In this module, I would like the users to give their instances URL, user name and password and get authenticated in the local instance. However, on clicking on the UI Action - Test Connection (Note : this ui action was created by doing an insert and stay on UI action- "Test Connection" present on sys_update_set_source table ) , I get an info message "Unable to validate connection: Missing URL" , any suggestion please why this is happening
UI Action( )
function validateConnection() {
var url = g_form.getValue('url');
url = url.trim();
var username = g_form.getValue('u_username');
var password = g_form.getValue('u_password');
var view = g_form.getValue('sysparm_view');
var sysid = gel('sys_uniqueValue').value;
var doEncrypt = g_form.isNewRecord()
|| g_form.modifiedFields['sys_update_set_source.password'] === true;
var ajax = new GlideAjax("com.glide.update.UpdateSetAjaxProcessor");
ajax.addParam("sysparm_function", "validateConnection");
ajax.addParam("sysparm_url", url);
ajax.addParam("sysparm_username", username);
ajax.addParam("sysparm_password", password);
ajax.addParam("sysparm_sysid",sysid);
ajax.addParam("sysparm_do_encrypt", doEncrypt);
ajax.addParam("ni.nolog.sysparm_password", "true");
ajax.getXML();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2017 11:26 PM
Hi Sohan,
What are you trying to achieve here?
Test Connection within team development for remote instances works fine.
Do you want to replicate this functionality for some other feature?
Also, have you created a separate table for storing these fields?( URL, username, password etc)
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 12:03 AM
hi Gaurav,
yes, 'test connection' works perfect on team development. I intend to replicate this feature for learning purpose and have created a separate table to store URL, user name and password. The previous issue is resolved and I am now getting a new error message while testing with user credentials (although this same user credentials when used in team development's remote instance is authenticates successfully)
I have made the below updates on the OOTB ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 12:41 AM
Hi Sohan,
I am afraid that the script include is not visible to us and its part of the core product.
Script include must be checking the table name somewhere within the code which is why it's not taking the custom username and passwords.
If your objective is to authenticate any user, then you can write custom UI action where you can use GlideUser.authenticate method from the login installation exits,
You don't need to check the same UI action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 03:29 AM
thanks , can I have this code, as its a screenshot I am unable to test it