Search code examples
pythonflaskstormpath

stormpath - how to control the directory used


using the Flask-Stormpath pip. here is the setup

app.config['STORMPATH_APPLICATION'] = my_app_name

I don't see any STORMPATH_DIRECTORY settings in the docs to allow developers to use applicationA with multiple directories.

EDIT: for login, i've extracted the authenticate_password method and I can pass the specific director like randall has stated

 authenticate_password(username, password, account_store=self.directory)

for the user sign up , I can't seem to find a solution

This is how i'm signing up in one of my applications:

authenticate_password(username, password, account_store=self.directory)

from flask.ext.stormpath import User as StormpathUser
data = {
            'email':  self._api_user_name_to_email(username),
            'password': password,
            'given_name': username,
            'surname': username,

        }
StormpathUser.create(**data)

any idea as how to explictly sign up the user in a spcific directory?


Solution

  • This is not yet supported (a preferred directory). In the integration, your first priority directory is used by default to create new users, etc.

    If this will not work for your use case, you can drop down to using the stormpath_manager.application object to create users manually in whatever directory you want.

    EG:

    stormpath_manager.application.create_account({...}, account_store=some_other_directory)