Are you saying that ultimately you want your Receiver app to be able to 
make Ajax calls to a third-party service (that will not be a web2py app) 
that requires basic authentication? If so, then auth.settings.login_methods 
= [basic_auth('http://127.0.0.1:8000/Provider')] in the Receiver app won't 
help, as that determines how users log in *to the Receiver app*. Once the 
user is logged in to the Receiver app, that only provides authorization for 
requests to the Receiver app (the basic authorization call to the Provider 
app only tells the Receiver app the user is allowed to be logged in to the 
Receiver app -- it doesn't log the user in to the Provider app). In fact, 
with basic authentication, there isn't really a notion of being "logged 
in", as you have to pass the login credentials in the HTTP headers with 
every request (i.e., you effectively have to log in with every request).

If you want to make Ajax requests to a service requiring basic 
authentication, you either need to have users input their login credentials 
on your page and then grab the credentials via Javascript and submit them 
in the HTTP headers (the jQuery .ajax() function makes this easy by letting 
you simply include "username" and "password" arguments), or you can make 
the request without the credentials, and the server should send a 401 
response, which will instruct the browser to prompt the user for the 
credentials (and the browser will cache the credentials for some period of 
time so the user doesn't have to keep re-entering them on every request). 
The latter is generally a less desirable user experience.

Anthony


On Tuesday, March 19, 2013 2:30:48 PM UTC-4, Subhamoy Sengupta wrote:
>
> Because the Provider will ultimately be replaced by a client's server. The 
> Provider app is for my learning and testing convenience.
>
>
> *
> On Tuesday, 19 March 2013 19:20:00 UTC+1, Cliff Kachinske wrote:*
>>
>> *Correct me if I'm wrong, but it seems like you are splitting the model 
>> and controller parts across two applications.*
>> *
>> *
>> *Why would you do that?  The Web2py architecture works best when one 
>> application handles model, view and controller functions for a set of 
>> related tables.  Each table, in turn, represents some real-world object.*
>> *
>> *
>> *This would all be so much simpler if you used the typical arrangement.*
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to