问题描述
能获取到token为什么注册用户的时候失败了呢?
解决方案
用我们的示例代码进行注册的吗?失败的报错有吗?贴一下看看。
解决方案二:
对啊 。用的是示例代码注册的。可惜没有失败的错误。if __name__ == '__main__': #测试数据 f = file("../info.json") s = json.load(f) appkey = s['appkey'] org, app = parse_appkey(appkey) org_admin_username = s['admin']['username'] org_admin_password = s['admin']['password'] client_id = s['app']['credentials']['client_id'] client_secret = s['app']['credentials']['client_secret'] app_admin_username = s['app']['admin']['username'] app_admin_password = s['app']['admin']['password'] # org_admin的认证方式 org_admin_auth = OrgAdminAccountAuth(org_admin_username, org_admin_password) # 获取org管理员的token print "Get org admin token: " + org_admin_auth.get_token() # 获取app管理员的token app_admin_auth = AppAdminAccountAuth(org, app, app_admin_username, app_admin_password) print "Get app admin token:" + app_admin_auth.get_token() # 通过client id和secret来获取app管理员的token app_client_auth = AppClientAuth(org, app, client_id, client_secret) print "Get app admin token with client id/secret: " + app_client_auth.get_token() print "now let's register some users...." app_users = [] #注册用户 username="jxxooj" password = '123456' success, result = register_new_user(org, app, app_admin_auth, username, password) if success: print "registered new user %s in appkey[%s]" % (username, appkey) app_users.append(username) else: print "failed to register new user %s in appkey[%s]" % (username, appkey) print "now let's send an image" success, result = send_file(org, app, app_client_auth, '../zjg.jpg') print result
解决方案三:
用clinet_id和client_secret获取token再从新注册