def create_user(user): auth0 = Auth0( domain=AUTH0_DOMAIN, token=AUTH0_TOKEN, ) auth0_client = Auth0(AUTH0_DOMAIN, AUTH0_TOKEN).users auth0_client.create(user)
def dashboard(): domain = env[constants.AUTH0_DOMAIN_KEY] token = constants.AUTH0_TOKEN auth0 = Auth0(domain, token) applications = auth0.clients.all(fields=[constants.NAME_KEY]) rules = auth0.rules.all(fields=[constants.NAME_KEY, constants.SCRIPT_KEY]) return render_template('dashboard.html', user=session[constants.PROFILE_KEY], applications=applications, rules=rules)
def create_user(token, domain): auth0 = Auth0(domain, token) print "Provide following params to create a user:"******"" print "Enter connection name: " connection_name = raw_input() print "" print "Enter email: " email = raw_input() print "" print "Enter user Name:" username = raw_input() print "" print "Enter password:"******"" create_user_payload = { "connection": connection_name, "email": email, "password": password } auth0.users.create(create_user_payload) print auth0.users.list()
import os import records import sqlalchemy from auth0.v2.management import Auth0 from . import myemail # Auth0 API Client auth0_domain = os.environ['AUTH0_DOMAIN'] auth0_token = os.environ['AUTH0_JWT_TOKEN'] auth0 = Auth0(auth0_domain, auth0_token) # Database connection. db = records.Database() # Storage Models # Note: Some of these are a little fancy (send email and such). # -------------- class Note(object): """A generic note of thankfulness.""" def __init__(self): self.body = None self.byline = None self.inbox = None self.archived = None def __repr__(self): return '<Note size={}>'.format(len(self.body))
from auth0.v2.management import Auth0 domain = 'myaccount.auth0.com' token = 'A_JWT_TOKEN' # You can generate one of these by using the # token generator at: https://auth0.com/docs/api/v2 auth0 = Auth0('myaccount.auth0.com', token) auth0.connections.all() print("hi i am done")
def get_client(self): self.client = Auth0(self.domain, self.token) return self.client
def get_users(self): self.get_token() auth0 = Auth0(env['AUTH0_DOMAIN'], self.token) return auth0.users.list()['users']