I\'m using webapp2_extras.appengine.auth in my project and it creates 3 tables in datastore: User, UserToken and Unique. All is good and working as it should...
My q
I had trouble finding exactly what to delete, since Unique model doesn't hold references to User. Here's the solution (with reference to docs):
from google.appengine.ext import ndb
from webapp2_extras import auth
class SomeUserHandler():
def forget_user(self):
auth = auth.get_auth()
user_dict = auth.get_user_by_session()
user = auth.store.user_model.get_by_id(user_dict['user_id'])
# from webapp2_extras.appengine.auth.models.User
# http://webapp-improved.appspot.com/_modules/webapp2_extras/appengine/auth/models.html#User
#
# def add_auth_id(self, auth_id):
# ...
# unique = '%s.auth_id:%s' % (self.__class__.__name__, auth_id)
# ...
Unique.delete_multi( map(lambda s: 'User.auth_id:' + s, user.auth_ids) )