Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Senior Member
Posts: 1
Registered: ‎08-31-2018

Geospatial Portal SDK - add new service with authorization

Hello,

 

I try to add new service with authorization to SDI Portal in javascript. I found an example "How to add service":

$GP.services.add({
url: "http://demo-apollo.hexagongeospatial.com/erdas-iws/ogc/wmts",
definitionName: "WMTS",
id: "wmts1"
}, function (result) {
$GP.ui.info(result.message + " [" + result.msId + "]");
}, function (err) {
$GP.ui.info(err.message === undefined ? "An error occurred." : "An error occurred. " + err.message, { type: "error" });
});

 

But there are not properties to specify login and password.

 

Any idea how to solve this (in javascript or .NET)?

 

Many thanks for your help!!!

Jan.

Highlighted
Staff
Posts: 3
Registered: ‎07-18-2018

Re: Geospatial Portal SDK - add new service with authorization

Hi @jan_krivanek 

To register a service with username authentication provide the following optional parameters when registering a service:

authenticationMethod: "username",
username: YOUR_USER_NAME,
password: YOUR_PASSWORD

Your code should be like this:

$GP.services.add({
    url: "http://demo-apollo.hexagongeospatial.com/erdas-iws/ogc/wmts",
    definitionName: "WMTS",
    id: "wmts1",
    authenticationMethod: "username",
    username: "test",
    password: "test"
}, function(result) {
    $GP.ui.info(result.message + " [" + result.msId + "]");
}, function(err) {
    $GP.ui.info(err.message === undefined ? "An error occurred." : "An error occurred. " + err.message, {
        type: "error"
    });
});


Regards,
Rostik Kurdiumov