RE: Login oauth (Google) not working

Dave ., modified 6 Years ago. New Member Posts: 2 Join Date: 7/10/19 Recent Posts
Hi,
I'm trying to login using the Liferay Mobile SDK for Android through a google oauth2 authentication but it's not working.
I haven't a liferay email to authenticate but it's the company domain like:

myname@mycompanyname.it

this is a google domain. In the web portal I can authenticate just pressing the button "Login with google". That's what i've done so far.

<com.liferay.mobile.screens.auth.login.LoginScreenlet
android:id="@+id/login_screenlet"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutId="@layout/login_material"
android:visibility="visible"
app:basicAuthMethod="email"
app:loginMode="oauth2UsernameAndPassword"
app:oauth2Redirect="@string/liferay_server"
app:credentialsStorage="shared_preferences"
app:oauth2ClientId="@string/clientIdOauth"
app:companyId="@string/bot_liferay_company_id" />
 I got the oauth2ClientId key from the tab  "Instance settings" of the portal under the section "Authentication" and then "Google" is that correct?But here I have 2 problems. First one is that when I run the app and I try to login I get an error message "clientSecret cannot be null or empty" and the second is "Where is this clientSecret key??"
I also tried to change the loginMode in app:loginMode="oauth2Redirect". But in this way the login screen not appears. I've an empty activity. So, as last hope, I tried changing again the loginMode in "Basic". And in this way I've got this error "com.liferay.mobile.android.exception.AuthenticationException: java.lang.SecurityException". I can't understand if it's possible authenticate an user using a google account instead a liferay account because it's not working. Thanks 
thumbnail
Victor Galan, modified 6 Years ago. Regular Member Posts: 144 Join Date: 6/14/16 Recent Posts
HeyYou have to configure an oauth2 application in the portal if you want to use it, you can chose the oauth2 flow that fits your use case, for what you are describing you should go for authorization code (PKCS), and in screens its the oauth2Redirect mode, this would open a browser with the login page, which would contain login with google button.You can check the docs hereI hope it helps
Dave ., modified 6 Years ago. New Member Posts: 2 Join Date: 7/10/19 Recent Posts
I can't understand where to find the redirect page. I mean, my website url should be the same of the redirect page. When a user (not logged in) opens the web page (www.mysite.com) he sees the button "Sign in with google". And then he can enter in the website at the same url. But it's not working. It shows me a blank activity.  And I also have this error if I change the client type "Grant type "PKCE ... " is unsupported for this client type.