<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Oauth2 login failed</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113583798" />
  <subtitle>Oauth2 login failed</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113583798</id>
  <updated>2026-04-06T14:05:16Z</updated>
  <dc:date>2026-04-06T14:05:16Z</dc:date>
  <entry>
    <title>RE: Oauth2 login failed</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114109237" />
    <author>
      <name>László Tóth</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114109237</id>
    <updated>2019-06-24T19:50:04Z</updated>
    <published>2019-06-24T19:50:04Z</published>
    <summary type="html">I solved the problem. I use createBasicSession to authenticate user with email and pwd. I only use OAUTH2 credentials for guest users.</summary>
    <dc:creator>László Tóth</dc:creator>
    <dc:date>2019-06-24T19:50:04Z</dc:date>
  </entry>
  <entry>
    <title>RE: Oauth2 login failed</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113611426" />
    <author>
      <name>Victor Galan</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113611426</id>
    <updated>2019-05-13T07:27:30Z</updated>
    <published>2019-05-13T07:27:30Z</published>
    <summary type="html">Hey!&lt;br /&gt;&lt;br /&gt;​​​​​​​Can you share your oauth2 configuration? From the server</summary>
    <dc:creator>Victor Galan</dc:creator>
    <dc:date>2019-05-13T07:27:30Z</dc:date>
  </entry>
  <entry>
    <title>Oauth2 login failed</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113583797" />
    <author>
      <name>László Tóth</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113583797</id>
    <updated>2019-05-09T13:18:44Z</updated>
    <published>2019-05-09T13:18:44Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;I tried to log in to life portal (7.1) via SDK on android.&lt;br&gt;&lt;pre&gt;&lt;code&gt;implementation 'com.liferay.mobile:liferay-android-sdk:7.1.3'
implementation 'com.liferay.mobile:liferay-android-oauth:1.3.0'
implementation 'com.liferay.mobile:liferay-mobile-sdk-services:1.0'&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;I registreted a mobile app in portal's oath administration menu, created id and secret key.&lt;br&gt;&lt;br&gt;When I try to log in like this:&lt;br&gt;&lt;pre&gt;&lt;code&gt;OAuth2SignIn.signInWithUsernameAndPassword("&amp;lt;user_email&amp;gt;","&amp;lt;user_pwd&amp;gt;",new SessionImpl(SERVER),ID,SECRET,new ArrayList&amp;lt;string&amp;gt;(),new SessionCallback() {
  @Override
  public void onSuccess(Session newSession) {
    session=SessionContext.createOAuth2Session(newSession);
    LOG.info("LogIn success: " + session);
    LOG.info("LogIn success: " + SessionContext.isLoggedIn());

    loadUserData(callback);
  }

  @Override
  public void onFailure(Exception e) {
    e.printStackTrace();
    logout();
  }
});&amp;lt;/string&amp;gt;&amp;lt;/user_pwd&amp;gt;&amp;lt;/user_email&amp;gt;&lt;/code&gt;&lt;/pre&gt;The login always fail with com.liferay.mobile.android.exception.ServerException:&amp;nbsp;&lt;br&gt;&amp;nbsp; at com.liferay.mobile.android.auth.oauth2.TokenRequester.parseResponse(TokenRequester.java:113)&lt;br&gt;&amp;nbsp; at com.liferay.mobile.android.auth.oauth2.TokenRequester.access$300(TokenRequester.java:25)&lt;br&gt;&amp;nbsp; at com.liferay.mobile.android.auth.oauth2.TokenRequester$1.onResponse(TokenRequester.java:99)&lt;br&gt;&amp;nbsp; at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)&lt;br&gt;&amp;nbsp; at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)&lt;br&gt;&amp;nbsp; at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)&lt;br&gt;&amp;nbsp; at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)&lt;br&gt;&amp;nbsp; at java.lang.Thread.run(Thread.java:764)&lt;br&gt;&lt;br&gt;When I try to log in as guest, like this:&amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;OAuth2SignIn.clientCredentialsSignIn(new SessionImpl(SERVER),ID,SECRET,new ArrayList&amp;lt;string&amp;gt;(),new SessionCallback() {
  @Override
  public void onSuccess(Session newSession) {
    session=SessionContext.createOAuth2Session(newSession);
    LOG.info("LogIn Guest success: " + session);
  }

  @Override
  public void onFailure(Exception e) {
    e.printStackTrace();
    logout();
  }
});&amp;lt;/string&amp;gt;&lt;/code&gt;&lt;/pre&gt;the login is successful.&lt;br&gt;&lt;br&gt;Why can't I log in with user / pwd?&lt;br&gt;&lt;br&gt;Thanks for your help!&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>László Tóth</dc:creator>
    <dc:date>2019-05-09T13:18:44Z</dc:date>
  </entry>
</feed>
