'Add a client
hash its client_secret before putting it in the database.'

def add_client(self, client_id, client_secret, redirect_uri):

    for client in self.db.query(orm.OAuthClient).filter((orm.OAuthClient.identifier == client_id)):
        self.db.delete(client)
    self.db.commit()
    orm_client = orm.OAuthClient(identifier=client_id, secret=hash_token(client_secret), redirect_uri=redirect_uri)
    self.db.add(orm_client)
    self.db.commit()
