예제 #1
0
 def GET(self):
     '''
     授权成功(用户成功安装应用)
     '''
     data = web.input()
     if 'hmac' not in data or data['hmac'] != verify.cal_hmac_code(config.AppSecret, data):
         return 'hmac verify failed'
     auth_code = data['code']
     # 获取Token
     utils.disable_urllib3_warning()
     token = publicapp.generate_token(auth_code, redirect_uri_on_auth)
     return 'authcode=%s token=%s' % (auth_code, token)
예제 #2
0
 def test_generate_token(self):
     token = '93a4d98ab78843d2b9e7474436f2fe3c'
     code = 'a93cb80bcbbc45e2ae9af34593c213cc'
     redirect_url = 'http://localhost:8080/auth_confirm'
     self.assertEqual(token, publicapp.generate_token(code, redirect_url))