- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我们正在运行两个 mattermost 服务器。
我们有一个使用 https://github.com/Vaelor/python-mattermost-driver 登录的 python 进程将个人访问 token 与社区 Python 驱动程序一起使用。此过程有一个不会超时的 session ,这是使用个人访问 token 登录的好处之一。 https://docs.mattermost.com/developer/personal-access-tokens.html .
我们使用 client4 go 驱动程序的用户名和密码登录,这有效,但一段时间后超时。似乎无法使用个人访问 token 登录官方客户端 4 驱动程序。
Mattermost Client4 代码的文档位于 https://godoc.org/github.com/mattermost/platform/model#Client
client4 的源位于 https://github.com/mattermost/mattermost-server/blob/master/model/client4.go
看起来最接近可行的是使用用户名和密码登录,然后通过 client.MockSession 设置身份验证 token ,但测试失败。
对于 mattermost,使用 client4 go 驱动程序使用个人访问 token 登录的官方方式是什么?
最佳答案
关键是不登录、设置个人访问 token 和调用 client.GetMe。在查看 python 驱动程序源代码后,这一点变得很清楚。相关片段是。
fmt.Println("LoginAsTheBotUser", "Using personal access token")
client.AuthToken = mattermost_personal_access_token
client.AuthType = model.HEADER_TOKEN
if user, resp := client.GetMe(""); resp.Error != nil {
println("There was a problem logging into the Mattermost server. Are you sure the access token is valid?")
PrintError(resp.Error)
} else {
fmt.Println(client)
botUser = user
result = true
}
上下文。
/*
mattermost_user_email, mattermost_user_password and mattermost_personal_access_token
are globals set from reading a .env file on startup
*/
func LoginAsTheBotUser() bool {
fmt.Println("LoginAsTheBotUser")
fmt.Println("LoginAsTheBotUser", time.Now())
var result bool = false
if mattermost_personal_access_token == "" {
fmt.Println("LoginAsTheBotUser", "Getting access token from login with username and password")
if user, resp := client.Login(mattermost_user_email, mattermost_user_password); resp.Error != nil {
println("There was a problem logging into the Mattermost server. Are you sure ran the setup steps from the README.md?")
PrintError(resp.Error)
} else {
fmt.Println(client)
botUser = user
result = true
}
} else {
fmt.Println("LoginAsTheBotUser", "Using personal access token")
client.AuthToken = mattermost_personal_access_token
client.AuthType = model.HEADER_TOKEN
if user, resp := client.GetMe(""); resp.Error != nil {
//if user, resp := client.Login(mattermost_personal_access_token); resp.Error != nil {
println("There was a problem logging into the Mattermost server. Are you sure the access token is valid?")
PrintError(resp.Error)
} else {
fmt.Println(client)
botUser = user
result = true
}
}
fmt.Println("LoginAsTheBotUser", time.Now())
fmt.Println("LoginAsTheBotUser")
return result
}
关于go - 对于 mattermost,使用 client4 go 驱动程序使用个人访问 token 登录的官方方式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51795115/
今天上午据小米穿戴官方消息,为了保障更好的使用体验和更充足的备货,小米手表尊享版将延期至2020年2月开售。 据了解,早在今年11月初小米正式发布小米手表,共有标准版和尊享版两个版本,价格分别为1
我的意思是,如果我可以运行例如官方 docker 镜像 DEBIAN 并在此之上 运行具有相同支持架构的官方 docker 镜像 NGINX,例如Linux x86-64? 它会像我以非 docker
在 .NET 3.5 中,大量扩展方法被添加到核心代码库中。我注意到在 MSDN 中,IEnumerable<> 等添加了有关扩展方法的部分。 是否有已添加的所有扩展方法的列表以供引用? 编辑感谢您的
在vertx指南中,链接异步调用的顺序组合如下所示: FileSystem fs = vertx.fileSystem(); Future startFuture = Future.future();
neo4j 文档有 this page about creating unit tests for neo4j. 本质上它建议我们创建一个模拟数据库使用 graphDb = new TestGraph
我是 C++ 的新手,我想了解链接器是如何正式工作的。我正在使用 Linux Mint 16。是否存在 ld 链接器官方规范? 最佳答案 您可能会对链接器和共享库有更多了解 here还有here是 l
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我想创建一个自定义 Android 汽车应用程序,而不会分散驾驶员的注意力。我浏览了很多博客和网站,发现自 3.0 版本以来曾经有一些自定义应用程序被屏蔽。这些自定义应用程序的开发人员使用的是非官方的
我刚找到 this Project就像。嘿。为什么不尝试使用它呢? 所以。刚刚下载它(我没有做任何更改!),打开 Android Studio,运行它,然后遇到以下问题。 error: cannot
Docker 的官方 Postgres 镜像使用两个环境变量:POSTGRES_USER 和 POSTGRES_PASSWORD 参数化数据库创建: https://registry.hub.dock
我刚刚从 Python download page 下载了 Python 2.7.3 64 位安装程序我想验证签名。所以我需要导入 key ,我的首选方法是从受信任的 key 服务器获取它们。 Pyt
当我安装 Andoird 5.0 SDK 并导入 Camera2Basic 示例源代码时。CameraDevice.StateListener 和 CameraCaptureSession.State
在Design Philosophy节official Fragment guide ,它说: You should design each fragment as a modular and reu
我正在使用 Roslyn 编写一个应用程序来从语法和语义上分析 C# 源代码。对于正在分析的源代码中定义的每种类型,我想存储它是引用类型(类)、值类型(结构)还是接口(interface)。 类型的类
有没有官方的 XSLT 验证器,比如 http://validator.w3.org/用于 HTML 和 XHTML? 我知道http://validator.w3.org/也可用于验证 XML 和
我主要使用 C++ 进行科学计算,最近我一直将自己限制在一个非常类似于 C 的 C++ 特性子集;即,除了复杂和 STL 之外没有类/继承,模板仅用于查找/替换各种替换,以及其他一些我无法用语言表达的
我了解到Google会根据访问它的浏览器/设备来自动提供 TTF , EOT , WOFF 或 SVG 字体文件。 现在,我计划从服务器本身托管和提供字体文件,为此,我首先必须下载Web字体的所有文件
他们有什么不同? 例如,与官方 SDK 相比,选择 libfreenect 或 OpenNI+SensorKinect 有什么优势,反之亦然? 有什么缺点? 最佳答案 请注意,以下答案是按日期计算的,
我想使用官方的 Hashicorp 镜像来运行 Terraform 而不是手动安装。我已经关注了 dockerhub 上的文档,但没有关于如何在何处安装卷的任何详细信息 - 例如在当前目录中使用“ma
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 5 年前。
我是一名优秀的程序员,十分优秀!