Ejemplo n.º 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)
Ejemplo n.º 2
0
 def GET(self):
     '''
     处理安装应用时验证请求
     '''
     data = dict(web.input())
     if 'hmac' not in data or data['hmac'] != verify.cal_hmac_code(config.AppSecret, data):
         return 'hmac verify failed'
     if 'shop_key' not in data:
         return 'shop_key requires'
     # 验证通过,重定向回友好速搭
     state = None
     if 'state' in data:
         state = data['state']
     auth_url = publicapp.generate_authorize_url(redirect_uri_on_auth, data['shop_key'], state)
     #print state, data['shop_key']
     #print auth_url
     web.seeother(auth_url)