Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Liferay sceenlet pass session to webview
Hello,
I created a android application and using Login screenlet I am able to login and connect with Liferay instance.
Now, I want to show the loggedin user's private page using webview of android.
Is there any way to pass the session from login screenlet and open private page as loggedin in webview.
Or, is there any screenlet to show the page.
Thanks.
I created a android application and using Login screenlet I am able to login and connect with Liferay instance.
Now, I want to show the loggedin user's private page using webview of android.
Is there any way to pass the session from login screenlet and open private page as loggedin in webview.
Or, is there any screenlet to show the page.
Thanks.
Hi!
Next week we are going to release a new version of the library, this new version includes a new login method, cookie login!
This new login type will let you solve your problem in an easy way, once we release it we can give you indications on how to do it
Kind regards,
Víctor
Next week we are going to release a new version of the library, this new version includes a new login method, cookie login!
This new login type will let you solve your problem in an easy way, once we release it we can give you indications on how to do it
Kind regards,
Víctor
Hello Victor,
Thanks a lot, I will wait for the new update.
For now we got some workaround through following ways:
1. open https://localhost:8080?login=username&password=pass in webview
Or, we can go pass some encrypted token and based on auto login we can login.
Will cookie login work in liferay 6.2 and 7 both?
Thanks.
Thanks a lot, I will wait for the new update.
For now we got some workaround through following ways:
1. open https://localhost:8080?login=username&password=pass in webview
Or, we can go pass some encrypted token and based on auto login we can login.
Will cookie login work in liferay 6.2 and 7 both?
Thanks.
Nikhil Nishchal:
Will cookie login work in liferay 6.2 and 7 both?
It will (hopefully), but we'll have official support only for Liferay 7
I also have such a problem, how to solve now?
Cookie login is the way 
Available on the latest screens version
Available on the latest screens version
Thank you for your reply. However, for some reason, I can only use the 6.2 version, open the webview prompt and need to login,Can I get cookies on version 6.2.
Yes, it will also work on 6.2
I'm still confused by the web view's cookie, and here's how I actually use it.
Log in using screnntlet
Step 1: how to get cookie from Liferay?
Step 2: how to put cookie into webview?
Log in using screnntlet
<com.liferay.mobile.screens.auth.login.loginscreenlet android:id="@+id/login_screenlet" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerhorizontal="true" android:layout_below="@+id/include" liferay:basicauthmethod="screen_name" liferay:companyid="@string/id_company" liferay:layoutid="@layout/view_login_main"></com.liferay.mobile.screens.auth.login.loginscreenlet>Step 1: how to get cookie from Liferay?
Step 2: how to put cookie into webview?
Step 1: how to get cookie from Liferay?
Using liferay:loginMode="cookie" in your LoginScreenlet
Step 2: how to put cookie into webview?
It's done automatically if you use that loginMode
Using liferay:loginMode="cookie" in your LoginScreenlet
Step 2: how to put cookie into webview?
It's done automatically if you use that loginMode
When I using liferay:loginMode="cookie" in your LoginScreenlet,then login failed。
Below is the login error message.
Could not login
com.liferay.mobile.android.exception.AuthenticationException: Cookie invalid or empty
at com.liferay.mobile.android.auth.CookieSignIn.parseResponse(CookieSignIn.java:143)
at com.liferay.mobile.android.auth.CookieSignIn.signIn(CookieSignIn.java:55)
at com.liferay.mobile.screens.auth.login.interactor.LoginCookieInteractor.execute(LoginCookieInteractor.java:33)
at com.liferay.mobile.screens.base.interactor.BaseInteractor.doInBackground(BaseInteractor.java:38)
at com.liferay.mobile.screens.base.interactor.BaseInteractor$1.run(BaseInteractor.java:31)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
<com.liferay.mobile.screens.auth.login.loginscreenlet android:id="@+id/login_screenlet" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_below="@+id/include" liferay:basicAuthMethod="screen_name" liferay:companyId="@string/id_company" liferay:loginMode="cookie" liferay:layoutId="@layout/view_login_main" />Below is the login error message.
Could not login
com.liferay.mobile.android.exception.AuthenticationException: Cookie invalid or empty
at com.liferay.mobile.android.auth.CookieSignIn.parseResponse(CookieSignIn.java:143)
at com.liferay.mobile.android.auth.CookieSignIn.signIn(CookieSignIn.java:55)
at com.liferay.mobile.screens.auth.login.interactor.LoginCookieInteractor.execute(LoginCookieInteractor.java:33)
at com.liferay.mobile.screens.base.interactor.BaseInteractor.doInBackground(BaseInteractor.java:38)
at com.liferay.mobile.screens.base.interactor.BaseInteractor$1.run(BaseInteractor.java:31)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Hi!
This error normally appears when the credentials are incorrect
I see that are you using screen_name as the basicAuthMethod, do you have that configured in the server too?
Regards
This error normally appears when the credentials are incorrect
I see that are you using screen_name as the basicAuthMethod, do you have that configured in the server too?
Regards
If don't use loginMode,I can login successfully
Is server needs to configure cookies related Settings.
Is server needs to configure cookies related Settings.
It's not needed, what version of the library are you using?
android sdk 6.2
I meant the Liferay screens version, and the portal version?
liferay-screens:2.1.1
portal version:6.2
portal version:6.2
Can you execute this cURL request and tell me if you are receiving a correct status code?
curl -X POST \
<your-liferay-server>/c/portal/login \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Cookie: COOKIE_SUPPORT=true;' \
-d 'login=<screen-name>&password=<password>'
</password></screen-name></your-liferay-server>
Hi
I receiver status code 302.
But if I use
I can receiving a correct status code.
I receiver status code 302.
But if I use
<your-liferay-server>/login?p_p_id=58&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&saveLastPath=false&_58_struts_action=%2Flogin%2Flogin</your-liferay-server>I can receiving a correct status code.
Hi,Is there a way to solve this problem now?
Can you try with the version 3.1.0 of screens?
Today I tried the latest version(3.1.0) and failed.
It's very strange because internally it is doing the same request that you did with the cURL and that worked
Can you try this now:
Regards
Can you try this now:
CookieAuthentication authentication =
new CookieAuthentication("", "", "<your-screen-name>", "<your-password>");
Session session = new SessionImpl("<your-server-url>", authentication);
CookieSignIn.signIn(session, new CookieSignIn.CookieCallback() {
@Override
public void onSuccess(Session session) {
Log.d("LOGIN", "Login correct");
}
@Override
public void onFailure(Exception e) {
Log.e("LOGIN", "Login error", e);
}
</your-server-url></your-password></your-screen-name>Regards
Thank you for your reply. I am sorry that the server is being upgraded today, and I will test this method immediately after the server has been restored.
Community
Company
Feedback