• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 559
  • Last Modified:

Android Studio unable to login in using REST service 403 forbidden


I have a small simple app that you can log into or register as a new user.

The platform is:
 Windows server 2013
Android Studio
MYSQL database
Apache web server
Hosted on  a VM
Access is from my local machine to the VM using my personal network.

The problem i have is when i login in i get a response from the app saying 'Incorrect username or password' even though i can verify that is the correct UID and PWD.
I ran the login section in debug mode and could see my UID and PWD being sent to the REST service in the correct format and matches whats set in the DB.
Likewise when i go to register a new user i get unable to register user. Even though I can see that my new user was reisgtered and the DB updated with my info.

When i review the android stusio log cat I see an error 403 forbidden  when attempting to log in or register a new user.

So this has made me think that the message has been read (UID, PWD) successfully but is not retuning a success message back to my app.
I can only think that is the apache httpd.conf is causing some access denied.
is there any setting wihtin that file that could be causing a 403 error?
  • 2
1 Solution
Look in apache error log?
wilko1000Author Commented:
Apache log nothing relevant:

[Thu May 07 20:43:24.668732 2015] [mpm_winnt:notice] [pid 3616:tid 396] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations
[Thu May 07 20:43:24.686733 2015] [mpm_winnt:notice] [pid 3616:tid 396] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Thu May 07 20:43:24.686733 2015] [core:notice] [pid 3616:tid 396] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9'
[Thu May 07 20:43:24.692733 2015] [mpm_winnt:notice] [pid 3616:tid 396] AH00418: Parent: Created child process 3048
[Thu May 07 20:43:26.132815 2015] [mpm_winnt:notice] [pid 3048:tid 324] AH00354: Child: Starting 64 worker threads.
[Thu May 07 21:28:47.525391 2015] [mpm_winnt:notice] [pid 3616:tid 396] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu May 07 21:28:53.609402 2015] [mpm_winnt:notice] [pid 3048:tid 324] AH00364: Child: All worker threads have exited.
[Thu May 07 21:28:55.731005 2015] [mpm_winnt:notice] [pid 3616:tid 396] AH00430: Parent: Child process 3048 exited successfully.

 PHP logs how tack about depreciation, not sure if that would cause 403 error:

[24-Feb-2015 00:26:41 Europe/Paris] PHP Stack trace:
[24-Feb-2015 00:26:41 Europe/Paris] PHP   1. {main}() C:\wamp\www\RESTApi\index.php:0
[24-Feb-2015 00:26:41 Europe/Paris] PHP   2. DB_Functions->__construct() C:\wamp\www\RESTApi\index.php:19
[24-Feb-2015 00:26:41 Europe/Paris] PHP   3. DB_CONNECT->connect() C:\wamp\www\RESTApi\include\DB_Functions.php:13
[24-Feb-2015 00:26:41 Europe/Paris] PHP   4. mysql_connect() C:\wamp\www\RESTApi\db_connect.php:28
[24-Feb-2015 00:26:41 Europe/Paris] PHP Deprecated:  mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\RESTApi\db_connect.php on line 28

Acce log show: - - [07/May/2015:21:25:05 +0100] "GET /phpmyadmin/db_structure.php?server=1&db=&token=28fca39122735352029ff889f9fcaf42&ajax_request=true&ajax_page_request=true&menuHashes=73576858-8e7c1637-57ebd3e0-039a4e1f-cdd97c02-ebda6254-410af484&_nocache=1431030305282807846 HTTP/1.1" 200 14890 - - [07/May/2015:21:25:08 +0100] "GET /phpmyadmin/index.php?token=28fca39122735352029ff889f9fcaf42&ajax_request=true&ajax_page_request=true&menuHashes=73576858-8e7c1637-57ebd3e0-039a4e1f-cdd97c02-ebda6254-410af484&_nocache=1431030308781157324 HTTP/1.1" 200 38594 - - [07/May/2015:21:25:09 +0100] "GET /phpmyadmin/version_check.php?&_nocache=1431030309377128445 HTTP/1.1" 200 39 - - [07/May/2015:21:25:11 +0100] "GET /phpmyadmin/server_privileges.php?db=&token=28fca39122735352029ff889f9fcaf42&viewing_mode=server&ajax_request=true&ajax_page_request=true&menuHashes=8e7c1637-57ebd3e0-039a4e1f-cdd97c02-ebda6254-410af484-4f748949&_nocache=1431030311052627923 HTTP/1.1" 200 13201 - - [07/May/2015:21:25:11 +0100] "GET /phpmyadmin/js/get_scripts.js.php?scripts[]=server_privileges.js&token=28fca39122735352029ff889f9fcaf42&call_done=1 HTTP/1.1" 200 26581 - - [07/May/2015:21:25:41 +0100] "POST /RESTApi/ HTTP/1.1" 200 80 - - [07/May/2015:21:26:21 +0100] "POST /RESTApi/ HTTP/1.1" 200 5271 - - [07/May/2015:21:26:43 +0100] "POST /RESTApi/ HTTP/1.1" 200 80
But none of that logs show 403 being passed to user. Can you try to record traffic with network monitor or wireshark on your server when 403 occurs? Then on android accessing it over private wifi?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now