neoneye
neoneye

Reputation: 52191

How to users.set_current_user?

How to create a custom login system with google-app-engine's User class?

I'm making my own login system. I have tried os.environ['USER_EMAIL'] = '[email protected]', but it doesn't work. I guess the information is not saved in a session, so if I visit another page then users.get_current_user() has no memory of what I had set it to previously.

I have seen google-app-engine unit tests that does this to fake a logins. I think these works because the tests are within the same session. I need to store my own custom information across multiple sessions.

I have also tried setting environment variables, but without luck.

os.environ['USER_EMAIL'] = '[email protected]'
os.environ['USER_ID'] = 'todo_user_id'
os.environ['USER_IS_ADMIN'] = '1'
os.environ['AUTH_DOMAIN'] = 'todo_auth_domain'
os.environ['FEDERATED_IDENTITY'] = 'todo_federated_identity'
os.environ['FEDERATED_PROVIDER'] = 'todo_federated_provider'

Upvotes: 0

Views: 425

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101139

You can't - the Users API only supports signing in with methods supported by that API. If you want to implement your own signin, you will need to use a third-party session library and keep track of logged in users the 'regular' way.

Upvotes: 3

Related Questions