# Deeplink login

**URL:** <https://forum.servoy.com/t/deeplink-login/11630>\
**Category:** Classic Servoy\
**Created:** [January 18, 2010, 9:08am UTC](https://forum.servoy.com/t/deeplink-login/11630 "2010-01-18T09:08:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [January 18, 2010, 9:08am UTC](https://forum.servoy.com/t/deeplink-login/11630/1 "2010-01-18T09:08:07Z")

</div>

Hi,

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.

Is there something were doing wrong?

(See the attachment for our sample solution)

[Deeplink.zip](https://forum.servoy.com/uploads/short-url/lUm3F3xmPtaOpDkDjxGE8gskX3H.zip) (8.56 KB)

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [January 20, 2010, 1:51pm UTC](https://forum.servoy.com/t/deeplink-login/11630/2 "2010-01-20T13:51:17Z")

</div>

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:

```auto
var inside = 0;

function loginmethod( usr, pwd)
{
	if (inside == 1) return;
	inside = 1;
	
	try {
		(... method code ...)
	} finally {
		inside = 0;
	}
}

```

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [January 25, 2010, 1:04pm UTC](https://forum.servoy.com/t/deeplink-login/11630/3 "2010-01-25T13:04:34Z")

</div>

Thanks for your answer.

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)

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [January 25, 2010, 1:11pm UTC](https://forum.servoy.com/t/deeplink-login/11630/4 "2010-01-25T13:11:28Z")

</div>

What version of Servoy do you use?

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 25, 2010, 1:44pm UTC](https://forum.servoy.com/t/deeplink-login/11630/5 "2010-01-25T13:44:16Z")

</div>

yeah, we filed a case a long time ago about this.

this is the response we got from Andrei:

> 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.

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [January 25, 2010, 2:41pm UTC](https://forum.servoy.com/t/deeplink-login/11630/6 "2010-01-25T14:41:00Z")

</div>

Ok, so as I understand, there is just no way to have a external login page then?

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [January 25, 2010, 2:44pm UTC](https://forum.servoy.com/t/deeplink-login/11630/7 "2010-01-25T14:44:02Z")

</div>

> Harjo:  
> (…)this is the response we got from Andrei:(…)

I already forgot about that ![:P]( "Razz") . 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… ![:oops:]( "Embarassed")

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 26, 2010, 3:32pm UTC](https://forum.servoy.com/t/deeplink-login/11630/8 "2010-01-26T15:32:38Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [January 26, 2010, 3:58pm UTC](https://forum.servoy.com/t/deeplink-login/11630/9 "2010-01-26T15:58:09Z")

</div>

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.

See [http://wiki.servoy.com/display/DOCS/Smart+Client](http://wiki.servoy.com/display/DOCS/Smart+Client) and [http://wiki.servoy.com/display/DOCS/Web+Client](http://wiki.servoy.com/display/DOCS/Web+Client) for the options to specify arguments on the url’s

Paul

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 26, 2010, 6:42pm UTC](https://forum.servoy.com/t/deeplink-login/11630/10 "2010-01-26T18:42:49Z")

</div>

Paul is this really true?

we checked this before, if you specify a global method with arguments, the method with arguments are only fired, when you are (already) logged in

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [January 26, 2010, 6:55pm UTC](https://forum.servoy.com/t/deeplink-login/11630/11 "2010-01-26T18:55:00Z")

</div>

Ofcourse it’s true or else I wouldn’t be saying it! ![:)]( "Smile")

But, you haven’t read what I said. I said “not with a method”

Big difference…

Paul

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 26, 2010, 9:26pm UTC](https://forum.servoy.com/t/deeplink-login/11630/12 "2010-01-26T21:26:38Z")

</div>

ah oke, thanks for pointing that out! ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [January 27, 2010, 7:16am UTC](https://forum.servoy.com/t/deeplink-login/11630/13 "2010-01-27T07:16:43Z")

</div>

> pbakker:  
> I said “not with a method”

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 ![:)]( "Smile") )

The handling of the arguments is as Paul pointed out from the ‘onLoad’ on the loginform.

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [January 28, 2010, 10:39am UTC](https://forum.servoy.com/t/deeplink-login/11630/14 "2010-01-28T10:39:39Z")

</div>

> pbakker:  
> [http://wiki.servoy.com/display/DOCS/Web+Client](http://wiki.servoy.com/display/DOCS/Web+Client) for the options to specify arguments on the url’s
> 
> Paul

This really helped out, thanks.

---

<div class="post-metadata">

**Author:** ![rogel](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rogel](https://forum.servoy.com/u/rogel)\
**Post date:** [October 27, 2011, 4:38am UTC](https://forum.servoy.com/t/deeplink-login/11630/15 "2011-10-27T04:38:23Z")

</div>

> mboegem:
> 
> > pbakker:  
> > I said “not with a method”
> 
> 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 ![:)]( "Smile") )
> 
> 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

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [October 27, 2011, 6:49am UTC](https://forum.servoy.com/t/deeplink-login/11630/16 "2011-10-27T06:49:56Z")

</div>

Hi,

We have a deeplink solution with our webclient and our onLoad looks like this:

```auto
function onLoad(event)
{
	//Get the arguments if they are specified
	var args = application.getStartupArguments();	
	
	//read args & rest of code herehere

}

```

With the application.getStartupArguments() you read the arguments you specified.

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [October 27, 2011, 8:27am UTC](https://forum.servoy.com/t/deeplink-login/11630/17 "2011-10-27T08:27:55Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![rogel](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rogel](https://forum.servoy.com/u/rogel)\
**Post date:** [October 31, 2011, 10:40pm UTC](https://forum.servoy.com/t/deeplink-login/11630/18 "2011-10-31T22:40:52Z")

</div>

> mboegem:
> 
> > 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?

Thanks!

---

<div class="post-metadata">

**Author:** ![rogel](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rogel](https://forum.servoy.com/u/rogel)\
**Post date:** [November 22, 2011, 6:27am UTC](https://forum.servoy.com/t/deeplink-login/11630/19 "2011-11-22T06:27:42Z")

</div>

Hi Marc,

What do you mean by

```auto
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](http://x.x.x.x):x/servoy-client/sampledeeplink.jnlp?m=doActionBypassLogin&a=xyz&username=abc&password=123

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [November 22, 2011, 1:52pm UTC](https://forum.servoy.com/t/deeplink-login/11630/20 "2011-11-22T13:52:03Z")

</div>

Hi Rogel,

what I mean is that you should read the arguments in the ‘doActionBypassLogin’ method.  
something like this:

```auto
function doActionBypassLogin()
{
   var _args = arguments;
   // now you can work with the arguments as you like...
}

```

Don’t use the application.getStartupArguments() (which is deprecated in v6 anyway…)

[Next page](https://forum.servoy.com/t/deeplink-login/11630.md?page=2)
