[web2py] always get "This webpage has a redirect loop" if use google oauth2

2013-12-30 Thread Wei Li
I am trying to make a tiny example to login my app via google oauth2. 
However, I always got  "This webpage has a redirect loop" error from the 
browser if I use @auth.requires_login() pragma.

Model Code:
from gluon.contrib.login_methods.oauth20_account import OAuthAccount
auth.settings.login_form=OAuthAccount(
 client_id="XXX.apps.googleusercontent.com",
 client_secret="YYY",
 auth_url="https://accounts.google.com/o/oauth2/auth";,
 token_url="https://accounts.google.com/o/oauth2/token";,
 scope="openid profile email")


Controller code:
@auth.requires_login()
def index():
return dict(message="index")


Redirect URL set in google API console: 
https://www.limijd.me/example_oauth2/default/user/login


I have tried to use web2py's build-in local authentication method by 
removing my code in model instead of using oauth2. Then the URL redirecting 
is good.

I have read the web2py manual book, in 9.1.2, it says for Janrain:
When a new user logins for the first time, web2py creates a new db.auth_user 
record associated to the user. It will use the registration_id field to 
store a unique id for the user.


However for OAuth2 login, apparently there is no new record created in 
db.auth_user like what web2py will do for Janrain. My suspicion is even I 
successfully logged in via OAuth2, web2py still doesn't consider I was 
logged in. I have removed the @auth.requires_login() and I am able to get 
the valid accessToken(). 

Please help if you know what could be the issue... 

Thanks a lot.
Wei



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] always get "This webpage has a redirect loop" if use google oauth2

2013-12-31 Thread Vinicius Assef
I'm experiencing the same problem but with CAS provider in version 2.8.2.

I sent 2 emails to this list some days ago, but until now I didn't saw
a solution. :-(

On Tue, Dec 31, 2013 at 4:47 AM, Wei Li  wrote:
> I am trying to make a tiny example to login my app via google oauth2.
> However, I always got  "This webpage has a redirect loop" error from the
> browser if I use @auth.requires_login() pragma.
>
> Model Code:
> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
> auth.settings.login_form=OAuthAccount(
>  client_id="XXX.apps.googleusercontent.com",
>  client_secret="YYY",
>  auth_url="https://accounts.google.com/o/oauth2/auth";,
>  token_url="https://accounts.google.com/o/oauth2/token";,
>  scope="openid profile email")
>
>
> Controller code:
> @auth.requires_login()
> def index():
> return dict(message="index")
>
>
> Redirect URL set in google API console:
> https://www.limijd.me/example_oauth2/default/user/login
>
>
> I have tried to use web2py's build-in local authentication method by
> removing my code in model instead of using oauth2. Then the URL redirecting
> is good.
>
> I have read the web2py manual book, in 9.1.2, it says for Janrain:
> When a new user logins for the first time, web2py creates a new db.auth_user
> record associated to the user. It will use the registration_id field to
> store a unique id for the user.
>
>
> However for OAuth2 login, apparently there is no new record created in
> db.auth_user like what web2py will do for Janrain. My suspicion is even I
> successfully logged in via OAuth2, web2py still doesn't consider I was
> logged in. I have removed the @auth.requires_login() and I am able to get
> the valid accessToken().
>
> Please help if you know what could be the issue...
>
> Thanks a lot.
> Wei
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] always get "This webpage has a redirect loop" if use google oauth2

2014-01-01 Thread Tim Richardson
I've just tried CAS for the first time (2.8.2). I also get the redirect 
loop.
The provider is a newly cloned welcome app running on an SSL server.
The consumer is running on a test server (same machine). 

I have a controller (CAS consumer) 
http://127.0.0.1:8050/olap/default/merge_patients
decorated with

@auth.requires_login()

After logging in on the provider, I get sent to 
http://127.0.0.1:8050/olap/default/user/login
and Firefox gives the redirect error




On Wednesday, 1 January 2014 04:18:34 UTC+11, viniciusban wrote:
>
> I'm experiencing the same problem but with CAS provider in version 2.8.2. 
>
> I sent 2 emails to this list some days ago, but until now I didn't saw 
> a solution. :-( 
>
> On Tue, Dec 31, 2013 at 4:47 AM, Wei Li > 
> wrote: 
> > I am trying to make a tiny example to login my app via google oauth2. 
> > However, I always got  "This webpage has a redirect loop" error from the 
> > browser if I use @auth.requires_login() pragma. 
> > 
> > Model Code: 
> > from gluon.contrib.login_methods.oauth20_account import OAuthAccount 
> > auth.settings.login_form=OAuthAccount( 
> >  client_id="XXX.apps.googleusercontent.com", 
> >  client_secret="YYY", 
> >  auth_url="https://accounts.google.com/o/oauth2/auth";, 
> >  token_url="https://accounts.google.com/o/oauth2/token";, 
> >  scope="openid profile email") 
> > 
> > 
> > Controller code: 
> > @auth.requires_login() 
> > def index(): 
> > return dict(message="index") 
> > 
> > 
> > Redirect URL set in google API console: 
> > https://www.limijd.me/example_oauth2/default/user/login 
> > 
> > 
> > I have tried to use web2py's build-in local authentication method by 
> > removing my code in model instead of using oauth2. Then the URL 
> redirecting 
> > is good. 
> > 
> > I have read the web2py manual book, in 9.1.2, it says for Janrain: 
> > When a new user logins for the first time, web2py creates a new 
> db.auth_user 
> > record associated to the user. It will use the registration_id field to 
> > store a unique id for the user. 
> > 
> > 
> > However for OAuth2 login, apparently there is no new record created in 
> > db.auth_user like what web2py will do for Janrain. My suspicion is even 
> I 
> > successfully logged in via OAuth2, web2py still doesn't consider I was 
> > logged in. I have removed the @auth.requires_login() and I am able to 
> get 
> > the valid accessToken(). 
> > 
> > Please help if you know what could be the issue... 
> > 
> > Thanks a lot. 
> > Wei 
> > 
> > 
> > 
> > -- 
> > Resources: 
> > - http://web2py.com 
> > - http://web2py.com/book (Documentation) 
> > - http://github.com/web2py/web2py (Source code) 
> > - https://code.google.com/p/web2py/issues/list (Report Issues) 
> > --- 
> > 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 web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] always get "This webpage has a redirect loop" if use google oauth2

2014-01-01 Thread Massimo Di Pierro
Hello Tim please open a ticket. I used this recently without problems. Make 
sure you list the steps and the code you changed from scaffolding.

On Wednesday, 1 January 2014 05:49:17 UTC-6, Tim Richardson wrote:
>
> I've just tried CAS for the first time (2.8.2). I also get the redirect 
> loop.
> The provider is a newly cloned welcome app running on an SSL server.
> The consumer is running on a test server (same machine). 
>
> I have a controller (CAS consumer) 
> http://127.0.0.1:8050/olap/default/merge_patients
> decorated with
>
> @auth.requires_login()
>
> After logging in on the provider, I get sent to 
> http://127.0.0.1:8050/olap/default/user/login
> and Firefox gives the redirect error
>
> Actually, I still get the error even when I use a CAS provider at 
> 127.0.0.1:8050
> I'll file a ticket
>
>
> On Wednesday, 1 January 2014 04:18:34 UTC+11, viniciusban wrote:
>>
>> I'm experiencing the same problem but with CAS provider in version 2.8.2. 
>>
>> I sent 2 emails to this list some days ago, but until now I didn't saw 
>> a solution. :-( 
>>
>> On Tue, Dec 31, 2013 at 4:47 AM, Wei Li  wrote: 
>> > I am trying to make a tiny example to login my app via google oauth2. 
>> > However, I always got  "This webpage has a redirect loop" error from 
>> the 
>> > browser if I use @auth.requires_login() pragma. 
>> > 
>> > Model Code: 
>> > from gluon.contrib.login_methods.oauth20_account import OAuthAccount 
>> > auth.settings.login_form=OAuthAccount( 
>> >  client_id="XXX.apps.googleusercontent.com", 
>> >  client_secret="YYY", 
>> >  auth_url="https://accounts.google.com/o/oauth2/auth";, 
>> >  token_url="https://accounts.google.com/o/oauth2/token";, 
>> >  scope="openid profile email") 
>> > 
>> > 
>> > Controller code: 
>> > @auth.requires_login() 
>> > def index(): 
>> > return dict(message="index") 
>> > 
>> > 
>> > Redirect URL set in google API console: 
>> > https://www.limijd.me/example_oauth2/default/user/login 
>> > 
>> > 
>> > I have tried to use web2py's build-in local authentication method by 
>> > removing my code in model instead of using oauth2. Then the URL 
>> redirecting 
>> > is good. 
>> > 
>> > I have read the web2py manual book, in 9.1.2, it says for Janrain: 
>> > When a new user logins for the first time, web2py creates a new 
>> db.auth_user 
>> > record associated to the user. It will use the registration_id field to 
>> > store a unique id for the user. 
>> > 
>> > 
>> > However for OAuth2 login, apparently there is no new record created in 
>> > db.auth_user like what web2py will do for Janrain. My suspicion is even 
>> I 
>> > successfully logged in via OAuth2, web2py still doesn't consider I was 
>> > logged in. I have removed the @auth.requires_login() and I am able to 
>> get 
>> > the valid accessToken(). 
>> > 
>> > Please help if you know what could be the issue... 
>> > 
>> > Thanks a lot. 
>> > Wei 
>> > 
>> > 
>> > 
>> > -- 
>> > Resources: 
>> > - http://web2py.com 
>> > - http://web2py.com/book (Documentation) 
>> > - http://github.com/web2py/web2py (Source code) 
>> > - https://code.google.com/p/web2py/issues/list (Report Issues) 
>> > --- 
>> > 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 web2py+un...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] always get "This webpage has a redirect loop" if use google oauth2

2014-01-02 Thread Tim Richardson


On Thursday, 2 January 2014 09:02:17 UTC+11, Massimo Di Pierro wrote:
>
> Hello Tim please open a ticket. I used this recently without problems. 
> Make sure you list the steps and the code you changed from scaffolding.
>

http://code.google.com/p/web2py/issues/detail?id=1840

I reproduced the problem with trunk and annotated the 1840 issue. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.