jjzjj

javascript - XmlHttpRequest 状态 0 而不是 IE 10 中的 401

我遇到了这个问题。我想这是某种IE错误,但我想确定一下。那么问题来了。为什么IE10XmlHttpRequest.status返回0而不是401?varxmlhttp=newXMLHttpRequest();xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){document.getElementById("rescode").innerHTML="Requestcompletedwithstatus:"+xmlhttp.status;}}xmlhttp.open("GET","http://hosting.g

php - Laravel 和 Passport,随机 401 错误

我正在编写单页Web应用程序。我在前端使用Vue.js,在后端使用Laravel。我包含了Passporttoken身份验证,并且正在发送authtokenvarlogin_data={client_id:2,client_secret:"SECRET_KEY",grant_type:"password",username:"mail",password:"pass"}到这个Passport端点http://IPADDRESS/oauth/token.然后我验证我的AJAX请求,包括这个header{'Authorization':'Bearer'+ACC_TOKEN}大多数时候一切正

php - 进行 Google plus API 调用时收到 HTTP 401 Unauthorized

我正在尝试通过API从Googleplus获取我所有好友的列表。我代表其执行此操作的用户先前授权了我的请求,并且我获得了授权token。我在php中尝试了以下代码:functionCallAPI(){$opts=array("http"=>array("method"=>"GET"));$url='https://www.googleapis.com/plus/v1/people/me/people/visible?key=XXXX';$context=stream_context_create($opts);$response=file_get_contents($url,false

php - 在 cURL 命令中获取 Firebase 云消息传递中的未经授权错误 401

我要发送Firebase云消息传递,我遇到的问题是我收到未经授权的错误401。我从我的Firebase网站获取了安全key,然后进行了设置。设备token已经在数据库中,我从数据库中读取没有问题。到目前为止,这是我的代码:$tokens,'data'=>$message);$headers=array('Authorization:key='."MyFirebasekey",'Content-Type:application/json');echo"workwellbeforeinitcurl";$ch=curl_init();echo"initwell";curl_setopt($c

php - 安全抛出 500 异常,在 TokenStorage 中找不到 token ,而不是 403 或 401

我通过ApiKey进行授权,如果没有提供授权数据,我想得到401Unauthorized,如果授权数据无效,我想得到403Forbidden.但是我在这两种情况下都遇到了500InternalServerError。security.yml:security:providers:api_key_user_provider:entity:class:RestBundle:RestUserproperty:apikeyfirewalls:rest_api_area:pattern:^/apistateless:truerest_auth:header:x-apikeyprovider:ap

php - Google Calendar API 出错 - 添加日历事件时需要 401 登录

因为我正在使用Codeigniter和GoogleapiService/apiCalendarService开发导出和导入到Google日历应用程序。当我从此页面向Google授权我的应用程序时,我已经完美地设置了一切,没问题:包含的代码是重定向发生时发生的事情:session_start();require(APPPATH.'libraries/google/apiClient.php');require(APPPATH.'libraries/google/contrib/apiCalendarService.php');$apiClient=newapiClient();$apiC

php - 401 Unauthorized DELETE request to RESTful API 通过 Ajax 在 laravel 中

我使用laravelController创建了一个restfulAPI。我有一个PhotosController,它有一个用于删除资源的destroy($id)方法。我还有一段javascript代码,可以向我的应用程序发送DELETE请求。结果应该是删除ID为$id的照片。但是laravel不会将我的请求路由到destroy方法。相反,它会发送一个401Unauthorized错误。问题是我想通过Ajax向我的应用程序发送DELETE请求,但是laravel不允许我的请求路由!routes.php文件:Route::resource('photos','PhotosControlle

php - Laravel API 身份验证(护照)隐式授予 token - 401 错误

我在使用Laravel5.5PassportAPI身份验证时遇到了一个非常奇怪的问题。我需要允许外部站点通过“隐式授予token”方法进行身份验证并从API获取数据。我卡在身份验证上了。JavaScript向API发送AJAX请求,但返回的只是401(未授权)错误(而不是token)。按照书上的设置(https://laravel.com/docs/5.5/passport#implicit-grant-tokens)全新的Laravel5.5安装添加LaravelCORShttps://github.com/barryvdh/laravel-corsPassport包安装compos

php - 401. 这是一个错误。错误 : invalid_client The OAuth client was not found

我正在按照此GoogleDriveFilePickerExample使用Google云端硬盘文件选择器演示项目。我已经生成了APIkey和客户端ID。但是当我运行该项目时,出现以下错误That’sanerror.Error:invalid_clientTheOAuthclientwasnotfound.我也检查了ThisGoogleDriveFilePickerExampleLink但它不起作用,请帮我解决我的问题。invalid_clientingoogleoauth2. 最佳答案 您的client_id不正确,请重新检查

php - 轮询器中的 Laravel 和 AJAX 偶发 401 错误

我正在使用Laravel5.0编写一个拍卖网站,该网站使用每5秒执行一次的AJAX轮询器模拟实时更新。问题是我的服务器返回零星的HTTP401状态。我的路线是这样build的:Route::post(auction/live/update,'AuctionController@ajaxSendUpdate');我的Controller是这样的:publicfunctionajaxSendUpdate(){//Businesslogic:queriesdatabase,coupleofIfs,etc…$data=array('success'=>true,'otherStuff'=>$m