RE: SignUpScreenlet

ildar sl, modified 5 Years ago. Regular Member Posts: 158 Join Date: 12/12/11 Recent Posts
Hi!
Liferay 7.2 GA 2 + Android Studio 3.5.3
Trying to register in a mobile application.

signup.xml
<com.liferay.mobile.screens.auth.signup.signupscreenlet android:id="@+id/signup_screenlet" android:layout_width="match_parent" android:layout_height="match_parent" app:anonymousApiPassword="@string/liferay_anonymousApiPassword" app:anonymousApiUserName="@string/liferay_anonymousApiUserName" />


SignUpActivity.java
public class SignUpActivity extends ThemeActivity implements SignUpListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.signup);
        SignUpScreenlet screenlet = findViewById(R.id.signup_screenlet);
        screenlet.setListener(this);
    }
    
    @Override
    public void onSignUpFailure(Exception e) {
        error(getString(R.string.signup_error), null);
    }
    
    @Override
    public void onSignUpSuccess(User user) {
        info(getString(R.string.sign_up_success_info) + " " + user.getId());
    }
}

LogError

2020-01-20 14:02:09.891 16631-16631/com.example.testforliferay E/LiferayScreens: Could not sign up
    com.liferay.mobile.android.exception.AuthenticationException: java.lang.SecurityException
        at com.liferay.mobile.android.http.Response.checkPortalException(Response.java:95)
        at com.liferay.mobile.android.http.Response.getBody(Response.java:49)
        at com.liferay.mobile.android.http.HttpUtil.post(HttpUtil.java:118)
        at com.liferay.mobile.android.http.HttpUtil.post(HttpUtil.java:128)
        at com.liferay.mobile.android.service.SessionImpl.invoke(SessionImpl.java:102)
        at com.liferay.mobile.screens.service.v70.UserService.addUser(UserService.java:78)
        at com.liferay.mobile.screens.auth.login.connector.UserConnector70.addUser(UserConnector70.java:44)
        at com.liferay.mobile.screens.auth.signup.interactor.SignUpInteractor.sendSignUpRequest(SignUpInteractor.java:103)
        at com.liferay.mobile.screens.auth.signup.interactor.SignUpInteractor.execute(SignUpInteractor.java:60)
        at com.liferay.mobile.screens.base.interactor.BaseInteractor$1.run(BaseInteractor.java:29)
        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)
2020-01-20 14:02:09.895 16631-16631/com.example.testforliferay E/LiferayScreens: Error


Help me please.
thumbnail
Javier Gamarra, modified 5 Years ago. Expert Posts: 348 Join Date: 2/12/15 Recent Posts
By default Liferay needs an authenticated user to do that request. You can create a user with only those permissions and use it as a token access or disable the security (that question would go in the general category, won't be of help there).
ildar sl, modified 5 Years ago. Regular Member Posts: 158 Join Date: 12/12/11 Recent Posts
Thanks