Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Ghislo · Sep 04, 2018 at 01:43 PM · androidandroid buildwwwmysqlphp

Android build, wwwform gives ssl.SSLHandshakeException

So, I have this code in the editor:

 string email = ifemail.text;
 string pssw = ifpassw.text;
 WWWForm form = new WWWForm();
 form.AddField("email", email);
 form.AddField("password", pssw);
 WWW w = new WWW("https://myserverpath/action_login.php", form);  
  
 yield return w;  
 
 if (string.IsNullOrEmpty(w.error))
 {
       if (w.text.Contains("invalid email or password"))
       {
                         // wrong data
       } else
       {
                         // login successful --> Return this in editor
       }
 } else
 {
             // comunication error --> return this in apk
 }



It works perfectly fine in the editor and I can both access and write on the db (so the php files work both for login and registration and db connection). Just in case this is the php code for login and connection: LOGIN :

 <?php
 include '../dbconnect.php';
 
 $email = $_POST['email'];
 $upass = $_POST['password'];
 
 $email = strip_tags($email);
 $upass = strip_tags($upass);
 
 $query = "SELECT userEmail FROM users WHERE userEmail='$email' AND userPass='$upass'";
 $result = mysqli_query($dbconnection, $query);
 
 $row = mysqli_fetch_row($result);
 if($row) {
     $dataArray = array('success' => true, 'error' => "$email");
 } else {
     $dataArray = array('success' => false, 'error' => 'invalid email or password');
 }
 
 header('Content-Type: application/json');
 echo json_encode($dataArray);
 
 ?>

CONNECT :

 <?php
 $dbuser = 'test_user';
 $dbpassword = 'blurredpassword';
 $db = 'test_db';
 $dbhost = 'XXX.XXX.X.XXX';
 
 $dbconnection = mysqli_connect($dbhost, $dbuser, $dbpassword, $db) or die("Connection failed " . mysql_error());
 
 ?>

If i build my apk, I cannot even get to connect to db. I searched for answers all around, but can't find a resolutive answer

I have internet access required in player settings, no custom manifest and tried both "https" and "http"

What am I missing? please help meh..

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image FernandoHC · Sep 04, 2018 at 02:21 PM 1
Share

it could be the case of missing crossreference. I suggest checking what error you are getting on w.error.

avatar image Ghislo FernandoHC · Sep 04, 2018 at 02:29 PM 0
Share

I checked and posted the log down in a reply! Hopefully it helps.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Ghislo · Sep 04, 2018 at 02:26 PM

I just run on the debugger and I get this :

 09-04 16:20:40.226 26328 26359 E Unity   : javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
     09-04 16:20:40.226 26328 26359 E Unity   :
     09-04 16:20:40.226 26328 26359 E Unity   : (Filename:  Line: 435)
     09-04 16:20:40.226 26328 26359 E Unity   :
     09-04 16:20:40.226 26328 26341 I Unity   : Error occurred :Unknown Error
     09-04 16:20:40.226 26328 26341 I Unity   :
     09-04 16:20:40.226 26328 26341 I Unity   : (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
     09-04 16:20:40.226 26328 26341 I Unity   :
 

Could it be related to the server provider? I'm not really an expert, but I read online it's a certification issue.. is it solvable?

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image FernandoHC · Sep 04, 2018 at 02:50 PM 1
Share

Are you running the server on the same pc as you are running the editor? This would bypass a lot of security. Hence the reason it works in editor and not on mobile. If not then you have the error now, gotta do some googling to find out more.

avatar image Ghislo FernandoHC · Sep 04, 2018 at 03:11 PM 1
Share

Nope, it's a hosted server. I'll google more tomorrow but, for now, I only found out it's a self-signed/missing intermediate CAs (Certificated Authorities) issue that happens only for Android for security reasons. https://developer.android.com/training/articles/security-ssl#java It explains quite well, but I don't see any solution i can directly apply..

I think it's related to the hosted provider certificates maybe not being on point for android development? I tried mailing them the error and we'll see if they can help me.

avatar image FernandoHC Ghislo · Sep 04, 2018 at 03:37 PM 0
Share

In this case, if it is in a private server that you don;t have full control over then you might have to ask them for some assistance in enabling things. This generally should not be an issue, since you are already going through php requests, so I don't really understand why this extra layer of security.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

213 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to get different variables from PHP page ? (example included)... 1 Answer

PHP Android WWW Unknown Error 1 Answer

www php send data to mysql 2 Answers

Unity - MySQL data loss 0 Answers

How can i connect my unity app made for android to connect with mysql database?,How do i able to make my android app made from Unity connect to Mysql database 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges