Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Jquery mobile+Phonegap mobile app and authentication
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Arash  
View profile  
 More options Jun 18 2012, 6:05 pm
From: Arash <arash.hem...@gmail.com>
Date: Mon, 18 Jun 2012 15:05:46 -0700 (PDT)
Local: Mon, Jun 18 2012 6:05 pm
Subject: Jquery mobile+Phonegap mobile app and authentication

Hi,
We are working on a mobile app for our SAAS website which uses Cake 1.3,
we've decided to use Jquery mobile+ Phonegap so we will use the HTML5 power
for building a mobile app.

The whole app is an HTML page with a few js ans css files which will be
running natively on the mobile and will interact with server with Ajax.

The problem we encountered here is that using the cakephp Auth the session
id is not being saved on the browser (because the page is not being served
from a webserver i think) so we don't have access to the session and we
can't know for sure if the user is authenticated or not.

I've seen some mobile authentication systems that provide a Token after
login, save it in browser local storage and send this token with each ajax
request to the server, the server checks the token and if it is valid then
severs the data.

Is there any reasonable way of authenticating users on a mobile app using
the Auth component?!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
JonStark  
View profile  
 More options Jun 21 2012, 9:39 am
From: JonStark <jean...@gmail.com>
Date: Thu, 21 Jun 2012 06:39:38 -0700 (PDT)
Local: Thurs, Jun 21 2012 9:39 am
Subject: Re: Jquery mobile+Phonegap mobile app and authentication

I can't help you, but was wondering exactly the same.

Le mardi 19 juin 2012 00:05:46 UTC+2, Arash a écrit :


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dr. Tarique Sani  
View profile  
 More options Jun 22 2012, 4:35 am
From: "Dr. Tarique Sani" <tariques...@gmail.com>
Date: Fri, 22 Jun 2012 14:05:27 +0530
Local: Fri, Jun 22 2012 4:35 am
Subject: Re: Jquery mobile+Phonegap mobile app and authentication
See http://book.cakephp.org/2.0/en/core-libraries/components/authenticati...

Tarique

--
=============================================================
PHP for E-Biz: http://sanisoft.com
=============================================================

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Arash  
View profile  
 More options Jun 23 2012, 8:45 am
From: Arash <arash.hem...@gmail.com>
Date: Sat, 23 Jun 2012 05:45:50 -0700 (PDT)
Local: Sat, Jun 23 2012 8:45 am
Subject: Re: Jquery mobile+Phonegap mobile app and authentication

Thanks Tarique, it looks to be the correct way but i didn't have any
success using it!

Here is what i did:

1. used HTTP Basic Authentication

class AppController extends Controller {

>     public $components = array(
>         'Session',
>         'RequestHandler',
>         'Auth' => array(
>             'authenticate' => array(
>                 'Basic' => array(
>                     'fields' => array('username' => 'email'),
>                     'realm' => 'touch'
>                 ),
>             ),
>         )
>     );
> }

2. created a login method which lets cross domain requests and cros domain
authorization

class UsersController extends AppController {

>     public function login() {
>         header("Access-Control-Allow-Origin: *");
>         header("Access-Control-Allow-Headers: Authorization");
>         $response = false;
>         if ($this->Auth->login()) {
>             $response = true;
>         }
>         $this->set('response',$response);
>     }

3. i've added this line to router file so that i can use json

> Router::parseExtensions('json');

4. in the client side, i make login request using ajax like this:

$.ajax({

>             url: url,
>             dataType: "json",
>             crossDomain: true,
>             beforeSend: function(xhr){
>                 xhr.setRequestHeader("Authorization", "Basic " +
> Base64.encode(email + ":" + password));
>             },
>             success: function ( response ) {
>                 console.log(response);
>             },            
>             error: function (xhr, ajaxOptions, thrownError) {
>                 console.log(xhr);
>             }
>         });

The problem is that after i login successfully the next ajax requests get
401 (Unauthorized), i've tried to debug the problem and it seems that once
client login, the next ajax requests get 401 because the get user method in
BasicAuthenticate class can't get the user via env('PHP_AUTH_USER') and
env('PHP_AUTH_PW')

Any idea why after successful ajax login the next ajax requests get 401
(Unauthorized) response?! why the authentication system can't get user by
env('PHP_AUTH_USER') ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andy  
View profile   Translate to Translated (View Original)
 More options Aug 26 2012, 9:22 am
From: Andy <andyfb...@gmail.com>
Date: Sun, 26 Aug 2012 06:22:49 -0700 (PDT)
Local: Sun, Aug 26 2012 9:22 am
Subject: Re: Jquery mobile+Phonegap mobile app and authentication

Arash,

I seem to have the same problem, would you mind posting your solution with
your sample code and all?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »