Fórum
LoginScreenlet oauth Exception
Harish Kumar, modificado 8 Anos atrás.
LoginScreenlet oauth Exception
Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi
I am using Liferay 6.2 and Liferay screens 1.3.0.
I am trying to use OAuth authentication but getting java.lang.NullPointerException: Attempt to invoke virtual method 'int com.liferay.mobile.screens.auth.BasicAuthMethod.ordinal()' on a null object reference. OAuth Provider EE plugin is deployed on liferay server. Basic authentication is working fine.
Complete stack trace
Regards,
Harish
I am using Liferay 6.2 and Liferay screens 1.3.0.
I am trying to use OAuth authentication but getting java.lang.NullPointerException: Attempt to invoke virtual method 'int com.liferay.mobile.screens.auth.BasicAuthMethod.ordinal()' on a null object reference. OAuth Provider EE plugin is deployed on liferay server. Basic authentication is working fine.
<com.liferay.mobile.screens.auth.login.loginscreenlet android:id="@+id/liferay_login" android:layout_width="match_parent" android:layout_height="wrap_content" app:layoutId="@layout/login_default" app:basicAuthMethod="email" app:oauthConsumerKey="xxxx" app:oauthConsumerSecret="xxxx" />
public class MainActivity extends AppCompatActivity implements LoginListener, View.OnClickListener {
private LoginScreenlet loginScreenlet;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
loginScreenlet = (LoginScreenlet) findViewById(R.id.liferay_login);
loginScreenlet.setListener(this);
findViewById(R.id.liferay_sign_up_button).setOnClickListener(this);
findViewById(R.id.liferay_forgot_button).setOnClickListener(this);
}
@Override
protected void onActivityResult(final int requestCode,final int resultCode,final Intent data)
{
super.onActivityResult(requestCode,resultCode,data);
if(resultCode == Activity.RESULT_OK)
{
loginScreenlet.sendOAuthResult(resultCode, data);
}
}
@Override
public void onLoginSuccess(User user) {
Toast.makeText(MainActivity.this, "User Login Successful", Toast.LENGTH_SHORT).show();
startActivity(new Intent(this, home.class));
}
@Override
public void onLoginFailure(Exception e) {
Toast.makeText(MainActivity.this, "Login Failed", Toast.LENGTH_SHORT).show();
}
@Override
public void onClick(View v) {
if(v.getId() == R.id.liferay_sign_up_button)
{
startActivity(new Intent(this, SignUpActivity.class));
}
else if(v.getId() == R.id.liferay_forgot_button)
{
startActivity(new Intent(this, ForgotPasswordActivity.class));
}
}
}
Complete stack trace
FATAL EXCEPTION: main
Process: com.example.harish.myapplication, PID: 11823
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.liferay.mobile.screens.auth.BasicAuthMethod.ordinal()' on a null object reference
at com.liferay.mobile.screens.viewsets.defaultviews.auth.login.LoginView.getLabelResourceForAuthMode(LoginView.java:210)
at com.liferay.mobile.screens.viewsets.defaultviews.auth.login.LoginView.onAttachedToWindow(LoginView.java:174)
at android.view.View.dispatchAttachedToWindow(View.java:14514)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2836)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1364)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Regards,
Harish
Javier Gamarra, modificado 8 Anos atrás.
RE: LoginScreenlet oauth Exception
Expert Postagens: 348 Data de Entrada: 12/02/15 Postagens Recentes
Yes, there is a small bug in Liferay Screens (it can be easily overridden by a custom view) and an incompatibility version problem between Liferay Screens and the Mobile SDK
We're ironing the version problem right now, if you need the OAuth support right now, I can try to fix it in the 1.3.1 branch...
We're ironing the version problem right now, if you need the OAuth support right now, I can try to fix it in the 1.3.1 branch...
Harish Kumar, modificado 8 Anos atrás.
RE: LoginScreenlet oauth Exception
Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi Javier,
Thanks for your response. Its not an urgent requirement so we can wait till next release.
Regards,
Harish
Thanks for your response. Its not an urgent requirement so we can wait till next release.
Regards,
Harish
Javier Gamarra, modificado 8 Anos atrás.
RE: LoginScreenlet oauth Exception
Expert Postagens: 348 Data de Entrada: 12/02/15 Postagens Recentes
Great! I'll update the thread when it's fixed