标签: http-status-code-401

Flask Web服务器的外部可见性问题

我已设法安装flask并运行hello-world脚本:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()
Run Code Online (Sandbox Code Playgroud)

我印象深刻,这是多么容易.然后我想让我的网络服务器在外部可见.按照建议,我把host='0.0.0.0'run函数作为参数.然后我找到了我的IP地址(在Google中)并将其放在我的Web浏览器的地址行中(当hello-world-script运行时).

结果我得到:"正在请求用户名和密码"和一个对话框,我需要输入用户名和密码.我不确定,但我认为它来自我的无线网络.有没有办法改变这种行为?

python flask http-status-code-401

4
推荐指数
1
解决办法
8926
查看次数

带门卫的Rails中的自定义401页面

我有一个使用Doorkeeper的Rails 4应用程序,要求在大多数控制器中进行身份验证.当我去其中一条限制路线时,我看到一个空白页面.我在终端注意到,Puma说:

过滤链停止为#Proc:0x007fd650803350 @/.../doorkeeper-0.7.2/lib/doorkeeper/helpers/filter.rb:8呈现或重定向已完成401未授权,1ms(ActiveRecord:0.0ms)

我怎样才能捕获这样的401 Unauthorized错误,以便显示自定义页面?我的目标是使用有关如何进行身份验证的消息呈现JSON响应,而不是仅显示空白页面.

ruby-on-rails unauthorized http-status-code-401 doorkeeper

4
推荐指数
1
解决办法
1688
查看次数

passport.js - 401错误后访问失败消息

目前我可以通过以下方式访问done(null, user, {message: 'ok'})内部帖子请求中设置的消息req.authInfo:

app.post('/reg', passport.authenticate('local-reg', { session: false }), function (req, res) {        
        console.log(req.authInfo.message); --> 'ok'         
});
Run Code Online (Sandbox Code Playgroud)

哪个非常有用.
但是我怎样才能done(null, false, {message: 'username taken'})以相同的方式访问这样的消息,因为看来传入done(null, false)passport.authenticate会使401无法通过,因此不会转发到路由处理程序本身.
也许我误会了什么?

PS:我正在发帖jQuery.post.

jquery node.js http-status-code-401 express passport.js

4
推荐指数
1
解决办法
1872
查看次数

curl 401未经授权的错误

如图所示,当我试图运行https://www.example.com/Push_Order.php?orderId=1562它给了我401 Unathorized错误.但是当我在浏览器中运行此Url时,它运行良好.

任何想法我的错误或我错过了什么?

在此输入图像描述

PHP卷曲代码

<?php

$ch = curl_init("https://www.example.com/Push_Order.php?orderId=1562");

curl_setopt($ch);

$response = curl_exec($ch);

curl_close($ch);
?>
Run Code Online (Sandbox Code Playgroud)

这个Push_Order.php文件只包含插入查询.

curl unauthorized http-status-code-401

4
推荐指数
1
解决办法
3万
查看次数

“不支持身份验证”:尝试克隆 tfs 托管的 git repo 时出现 jgit 错误

当我尝试从我的 linux 机器克隆一个 tfs 托管的 git repo http://tfstta.com:8080/tfs/DefaultCollection/_git/SampleTFSGit 时,我遇到了 Authentication not supported 错误:

org.eclipse.jgit.api.errors.TransportException:http://:@tfstta.int.thomson.com:8080/tfs/DefaultCollection/_git/SampleTFSGit.git:不支持身份验证*

启用基本身份验证/备用凭据似乎不是一个选项。

有人可以告诉我一个解决方法吗?我会很感激!

authentication git-clone http-status-code-401 tfs-2015

4
推荐指数
2
解决办法
1万
查看次数

从NiFi中的Java SDK调用时,Splunk抛出HTTP 401未授权错误

我有多个使用Cron驱动的调度策略运行的GetSplunk处理器.Cron表达式看起来像'0 30 13**?'.它们都在第一次运行时成功执行查询.但是,第二天它因Splunk的401错误而出错.来自nifi-app.log的错误如下.NiFi中的Cron调度程序是QuartzScheduler.

WARN [Timer-Driven Process Thread-7] o.a.n.c.t.ContinuallyRunProcessorTask Administratively 
Yielding GetSplunk[id=01581009-026c-114b-5e2e-401ebea6427d] due to uncaught Exception: 
com.splunk.HttpException: HTTP 401 -- call not properly authenticated
2016-12-21 13:30:00,300 WARN [Timer-Driven Process Thread-2] o.a.n.c.t.ContinuallyRunProcessorTask
com.splunk.HttpException: HTTP 401 -- call not properly authenticated
at com.splunk.HttpException.create(HttpException.java:84) ~[na:na]
at com.splunk.HttpService.send(HttpService.java:452) ~[na:na]
at com.splunk.Service.send(Service.java:1293) ~[na:na]
at com.splunk.HttpService.get(HttpService.java:165) ~[na:na]
at com.splunk.Service.export(Service.java:222) ~[na:na]
at com.splunk.Service.export(Service.java:237) ~[na:na]
at org.apache.nifi.processors.splunk.GetSplunk.onTrigger(GetSplunk.java:461) ~[na:na]
at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) ~[nifi-api-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1064) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at    org.apache.nifi.controller.scheduling.QuartzSchedulingAgent$2.run(QuartzSchedulingAgent.java:165) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_101]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_101] …
Run Code Online (Sandbox Code Playgroud)

java splunk http-status-code-401 apache-nifi

4
推荐指数
1
解决办法
1947
查看次数

OpenWeatherMap 中的 API 密钥无效(错误 401)

我正在尝试对 OpenWeatherMap 进行 API 调用。flutter run当我在终端中执行时,尽管我已经以适当的方式生成了 API 密钥并且它处于活动状态并正确复制,但打印出的是无效 API 密钥的代码response.statusCode401

const APIKey = '69f9afe03f52ef5c83887fc86dd79d99';

  void getData() async {
    http.Response response = await http.get(Uri.parse('https://api.openweathermap.org/data/3.0/onecall?lat=$latitude&lon=$longitude&appid=$APIKey'));
    if (response.statusCode == 200) {
      String data = response.body;
      var decodedData = jsonDecode(data);
      print(decodedData);
    } else {
      print(
        response.statusCode,
      );
    }
  }
Run Code Online (Sandbox Code Playgroud)

Flutter 的地理定位器包用于分配纬度和经度。如何401纠正错误?

api api-key http-status-code-401 flutter openweathermap

4
推荐指数
1
解决办法
3万
查看次数

IIS 7.5 MVC 2问题,出现401.3错误

我有一个混合的WebForms / MVC应用程序,我正尝试将其部署到暂存环境中,该环境是带有IIS 7.5的Server 2008 R2的全新安装。

在任何人的本地计算机上(通过Visual Studio的Web服务器)进行开发时,该应用程序都可以正常工作,但是当将其托管在登台服务器上时,会出现以下错误:

HTTP错误401.3-未经授权

由于Web服务器上此资源的访问控制列表(ACL)配置或加密设置,您无权查看此目录或页面。

我已设置为尝试解决此问题的方法:

  • 启用了匿名身份验证。
  • 禁用所有其他形式的身份验证。
  • 授权设置为允许所有用户。
  • IIS_IUSRS组可以通过文件系统进行访问。

asp.net-mvc authorization iis-7.5 http-status-code-401

3
推荐指数
1
解决办法
5420
查看次数

Django使用错误的凭据登录返回200而不是401

这是一个非常直接的测试,但我似乎无法做到正确.

我想检查哪些用户可以登录并执行操作(它是更大的测试套件的一部分),但第一步导致一些问题.

class SuperUserTest(TestCase):
    def setUp(self):
        self.client = Client()
        self.su = User.objects.create_superuser('super','','the_correct_password')
    def test_su_can_login(self):
        response = self.client.post(reverse('django.contrib.auth.views.login'),
            {'username': 'super', 'password': 'the_wrong_password'})
        self.assertEqual(response.status_code,401)

        # Success redirects to the homepage, so its 302 not 200
        response = self.client.post(reverse('django.contrib.auth.views.login'),
            {'username': 'super', 'password': 'the_correct_password'})
        self.assertEqual(response.status_code,302)
Run Code Online (Sandbox Code Playgroud)

当我运行测试时,我得到:

(my_app)00:20 ~/my_app (master)$ ./manage.py test my_app.SuperUserTest
Creating test database for alias 'default'...
F
======================================================================
FAIL: test_su_can_login (my_app.SuperUserTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./my_app/tests.py", line 341, in test_su_can_login
    self.assertEqual(response.status_code,401)
AssertionError: 200 != 401

----------------------------------------------------------------------
Ran 1 test …
Run Code Online (Sandbox Code Playgroud)

python django http-status-code-401

3
推荐指数
1
解决办法
1577
查看次数

Quickblox:无法通过FCM获取推送通知获得错误401

我想在FCM的应用程序中实现推送通知.该应用程序成功获得FCM推送,但当我想从Quickblox管理pannel发送,然后给我错误像

error_description":"无法发送通知20860148,收到错误401(未经授权,请检查您的应用程序auth_key.)

这是log.json文件: -

{"notification":{"registration_ids":["dA_lOjHQU2M:APA91bHB0zGuoalZoxtdcstBQ0dL0pPJA5HyUaoPVibD2iqnrUA51NLqrrmY5zrTZV7OaP55nUEber9NLkPs_ENkVtHLvbEAcHTrgh8wl_YoNhRsUNdyeIWt0mPDKk0tCDyLssXRuFu8"],"delay_while_idle":false,"data":{"message":"hii tesas","collapse_key":"event12616627"},"priority":"high","time_to_live":86400},"
Run Code Online (Sandbox Code Playgroud)

日志 ":[{" device_token ":NULL," created_at ":" 2016-12-14T09:56:50Z " "delivered_at":NULL, "failed_at": "2016-12-14T09:56:51Z"," error_code":401,"error_description":"无法发送通知20860148,收到错误401(未经授权,请检查您的应用程序auth_key.)"}]}

android http-status-code-401 google-cloud-messaging quickblox firebase-cloud-messaging

3
推荐指数
1
解决办法
836
查看次数