2016-03-12 52 views
1

我能够完成身份验证过程的前两个步骤。在步骤3,当我尝试通过交换授权代码来获取访问令牌时,我得到一个html响应,其中说“请求不再有效”。优步Api - 试图获得访问令牌返回HTML响应

<!DOCTYPE html> 
<!--[if lt IE 7]>  <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> 
<!--[if IE 7]>   <html class="no-js lt-ie9 lt-ie8"> <![endif]--> 
<!--[if IE 8]>   <html class="no-js lt-ie9"> <![endif]--> 
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <title>Uber </title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 
    <link rel="icon" href="https://d1a3f4spazzrp4.cloudfront.net/login/images/favicon.a767a268b86a6ce7d1099bec4a9e37aa.ico" type="image/x-icon" /> 
    <link rel="stylesheet" href="https://d1a3f4spazzrp4.cloudfront.net/login/style-login/style.ca8265c07903e433432af8462ac98f4e.css"> 
    <link href="https://d1a3f4spazzrp4.cloudfront.net/uber-icons/3.8.1/uber-icons.css" rel="stylesheet"/> 

    <link rel="stylesheet" href="https://d1a3f4spazzrp4.cloudfront.net/uber-fonts/2.0.1/superfine.css"/> 
    </head> 
<body> 
    <div class="content"> 
     <div class="icon-item text--center"> 
      <a href="https://www.uber.com/"> 
       <i class="icon icon_uber 
         push--top push-small--bottom 
"> 
       </i> 
      </a> 
     </div> 
    <p class="login-error-title text--center">Error</p> 
    <p class="login-error text--center push--top"> 
     Your request is no longer valid 
    </p> 
    </div> 

<script src="https://d1a3f4spazzrp4.cloudfront.net/login/scripts/analytics.30328e3569a665795cf94cbbf63985a8.js"></script> 
<script type="text/javascript"> 
    Analytics.init({ 
     services: { 
      tealium: { 
       account: 'uber', 
       profile: 'main', 
       env: 'prod', 
       geo: '' 
      } 
     } 
    }); 
</script> 

</body> 
</html> 

我能够在JSON响应中获得访问令牌。然后我做了一个小的代码重构。重构后,我没有得到JSON响应。

我尝试从我的超级配置文件断开应用程序并重试。但同样的错误。

回答

0

您使用节点吗?这里有一个使用Node + Express的working example ..还有一个包含vanilla JS web应用程序,它只需要授权后提供的access_token以获得进一步的请求。