We want to use the deeplinking to login in servoy.
Our setup is as followed, we deeplink to a global solution which calls our login method. But after a succesfull login, our custom login page is showed instead of the default form.
Make sure security.login() parameters are valid (check that uid and username are not null).
When those are ok then you are probably running into a problem that is fixed in future builds - the security.login(…) calls your method loginmethod(…) that calls back the security.login(…) and so on.
The workaround would be to make sure loginmethod(…) calls are not overlapping. Something like:
I tried your solution, but it still isn’t working correctly.
It seems that cause the solution is set to mustAuthenticate, the function in the deeplink isn’t called. But instead you get the login screen, cause you need to login(mustAuthenticate).
When I log in and then try the deeplink login again, it works.
So is there a solution or workaround for this, so we can make a deeplink login? (I don’t want to disable mustAuthenticate)
When you check the “Solution needs login” (and specify a login form or not), the global method specified in the deeplink will only execute after the login has been performed. So after the “security.login(…)” function is called in case you have a login form, the global method from the link will execute. This does work from what I tested. Executing methods from URL before login would be a security risk - as anyone would be able to execute any of the global methods without logging in, just by using an URL.
Harjo:
(…)this is the response we got from Andrei:(…)
I already forgot about that . Yes, you are both right, you can’t do that as it would mean anyone could call any of your global methods.
I just tested a bit before and it worked because I was using the same browser session where I was logged in earlier…
Janssenjos:
Ok, so as I understand, there is just no way to have a external login page then?
what we could try to do in a next version of servoy is that you can give arguments to the onload/onshow method of a the Login form.
So that when some identifier is given to that onload/onshow method you can test this and do the logon directly through your login form. (not even really showing it)
you could make a case for this if you would like something like that.
You can already deeplink into a solution and perform automatic login, just not using a method.
Just specify extra parameters on the url and in the onLoad of your login form check the startup arguments (application.getStartupArguments()) and if you receive the proper arguments (whatever you determine) log the user in and automatically the onsolutionstart method will fire and the first form will be shown.
We use a deeplink to pass credentials, but at the time building this I found that I couldn’t pass arguments without at least specify a global method in my deeplink as well.
To workaround this, I just created an empty global method ‘login’ which does nothing (as it’s empty )
The handling of the arguments is as Paul pointed out from the ‘onLoad’ on the loginform.
We use a deeplink to pass credentials, but at the time building this I found that I couldn’t pass arguments without at least specify a global method in my deeplink as well.
To workaround this, I just created an empty global method ‘login’ which does nothing (as it’s empty )
The handling of the arguments is as Paul pointed out from the ‘onLoad’ on the loginform.
Can anyone help me how to go about this? I am doing a deeplink login as well to automate the process inside the solution. Would the onLoad method of the login form require argument[0] to be of type JSEvent? How will the arguments be read?
here is the deeplink
localhost:50020/servoy-client/backuprestore.jnlp?m=start_autobackup&a=c:\dbbackup&username=abc&password=123
Janssenjos:
We have a deeplink solution with our webclient and our onLoad looks like this:
CODE: SELECT ALL
function onLoad(event)
{
//Get the arguments if they are specified
var args = application.getStartupArguments();
//read args & rest of code herehere
}
Hi Jos,
be careful: getStartupArguments in a webclient is a bit tricky.
If a user opens the solution in a 2nd browsertab (so he/she is opening 2 sessions), I found the getStartupArguments aren’t correct for the 2nd session.
So if the arguments you pass are different for each launch, you should really just ask for ‘arguments’ in the method you call in your deeplink.
Janssenjos:
We have a deeplink solution with our webclient and our onLoad looks like this:
CODE: SELECT ALL
function onLoad(event)
{
//Get the arguments if they are specified
var args = application.getStartupArguments();
//read args & rest of code herehere
}
Hi Jos,
be careful: getStartupArguments in a webclient is a bit tricky.
If a user opens the solution in a 2nd browsertab (so he/she is opening 2 sessions), I found the getStartupArguments aren’t correct for the 2nd session.
So if the arguments you pass are different for each launch, you should really just ask for ‘arguments’ in the method you call in your deeplink.
Hi Marc,
How would I implementation(deeplink URL and “arguments asking”) be to address both smart and web client during login?
So if the arguments you pass are different for each launch, you should really just ask for 'arguments' in the method you call in your deeplink.
can you site an example? if my deeplink url is http://x.x.x.x:x/servoy-client/sampledeeplink.jnlp?m=doActionBypassLogin&a=xyz&username=abc&password=123