OpenAI最新官方ChatGPT聊天插件接口《插件身份验证》全网最详细中英文实用指南和教程,助你零基础快速轻松掌握全新技术(三)(附源码)

Plugin authentication 插件身份验证

  • 前言
  • Plugin authentication 插件身份验证
  • No authentication 无认证
  • Service level 服务级别
  • User level 用户级别
  • OAuth
  • 其它资料下载

在这里插入图片描述

前言

“如果你不能信任插件,那么你就不能信任整个应用程序。”正因为如此,ChatGPT始终把插件认证放在极为重要的位置上,确保每一个插件都是可靠的、安全的。在ChatGPT中,插件认证机制可以保证用户数据和访问控制的安全。一个好的插件认证机制不仅需要能够验证插件的身份,还需要保护用户的隐私信息,并且确保插件只能访问其被授权的资源。

Plugin authentication 插件身份验证

Plugins offer numerous authentication schemas to accommodate various use cases. To specify the authentication schema for your plugin, use the manifest file. Our plugin domain policy outlines our strategy for addressing domain security issues. For examples of available authentication options, refer to the examples section, which showcases all the different choices.
插件提供了许多身份验证模式以适应各种用例。要指定插件的身份验证模式,请使用清单文件。我们的插件域策略概述了我们解决域安全问题的策略。有关可用身份验证选项的示例,请参阅示例部分,其中展示了所有不同的选项。

Note that the ai-plugin.json file requires an auth schema to be set. Even if you elect to use no authentication, it is still required to specify "auth": { "type": "none" }.
请注意, ai-plugin.json 文件需要设置 auth 模式。即使您选择不使用身份验证,仍然需要指定 "auth": { "type": "none" }

No authentication 无认证

We support no-auth flow for applications that do not require authentication, where a user is able to send requests directly to your API without any restrictions. This is particularly useful if you have an open API that you want to make available to everyone, as it allows traffic from sources other than just OpenAI plugin requests.
对于不需要身份验证的应用程序,我们支持无身份验证流,其中用户能够直接向您的API发送请求,而不受任何限制。如果你有一个开放的API,你想让每个人都可以使用,这是特别有用的,因为它允许来自其他来源的流量,而不仅仅是OpenAI插件请求。

"auth": {
  "type": "none"
},

Service level 服务级别

If you want to specifically enable OpenAI plugins to work with your API, you can provide a client secret during the plugin installation flow. This means that all traffic from OpenAI plugins will be authenticated but not on a user level. This flow benefits from a simple end user experience but less control from an API perspective.
如果你想专门启用OpenAI插件来与你的API一起工作,你可以在插件安装流程中提供一个客户端密码。这意味着来自OpenAI插件的所有流量都将进行身份验证,但不会在用户级别进行身份验证。此流程受益于简单的最终用户体验,但从API角度来看控制较少。

  • To start, a developer pastes in their access token (global key)
    首先,开发人员粘贴他们的访问令牌(全局密钥)
  • Then, they have to add the verification token to their manifest file
    然后,他们必须将验证令牌添加到他们的清单文件中
  • We store an encrypted version of the token
    我们存储令牌的加密版本
  • Users don’t need to do anything when they install the plugin
    用户在安装插件时不需要做任何事情
  • Last, we pass it in the Authorization header when making requests to the plugin (“Authorization”: “[Bearer/Basic][user’s token]”)
    最后,我们在向插件发出请求时将其传递到Authorization头中(“Authorization”:“[Bearer/Basic][user’s token]”)
"auth": {
  "type": "service_http",
  "authorization_type": "bearer",
  "verification_tokens": {
    "openai": "cb7cdfb8a57e45bc8ad7dea5bc2f8324"
  }
},

User level 用户级别

Just like how a user might already be using your API, we allow user level authentication through enabling end users to copy and paste their secret API key into the ChatGPT UI during plugin install. While we encrypt the secret key when we store it in our database, we do not recommend this approach given the poor user experience.
就像用户可能已经在使用您的API一样,我们允许最终用户在插件安装期间将其API密钥复制并粘贴到ChatGPT UI中,从而实现用户级身份验证。虽然我们在将密钥存储在数据库中时会对其进行加密,但考虑到用户体验较差,我们不建议使用这种方法。

  • To start, a user pastes in their access token when installing the plugin
    首先,用户在安装插件时粘贴他们的访问令牌
  • We store an encrypted version of the token
    我们存储令牌的加密版本
  • We then pass it in the Authorization header when making requests to the plugin (“Authorization”: “[Bearer/Basic][user’s token]”)
    然后,我们在向插件发出请求时将其传递到Authorization头中(“Authorization”:“[Bearer/Basic][user’s token]”)
"auth": {
  "type": "user_http",
  "authorization_type": "bearer",
},

OAuth

The plugin protocol is compatible with OAuth. A simple example of the OAuth flow we are expecting in the manifest looks like the following:
插件协议与OAuth兼容。我们在清单中期望的OAuth流的一个简单示例如下所示:

  • To start, a developer pastes in their OAuth client id and client secret
    首先,开发人员粘贴他们的OAuth客户端ID和客户端密码
    • Then they have to add the verification token to their manifest file
      然后他们必须将验证令牌添加到他们的清单文件中
  • We store an encrypted version of the client secret
    我们存储客户端机密的加密版本
  • Users log in through the plugin’s website when they install the plugin
    用户在安装插件时通过插件的网站登录
    • That gives us an OAuth access token (and optionally a refresh token) for the user, which we store encrypted
      这为我们提供了一个用户的OAuth访问令牌(以及可选的刷新令牌),我们将其加密存储
  • Last, we pass that user’s token in the Authorization header when making requests to the plugin (“Authorization”: “[Bearer/Basic][user’s token]”)
    最后,当向插件发出请求时,我们在Authorization头中传递该用户的令牌(“Authorization”:“[Bearer/Basic][user’s token]”)
"auth": {
  "type": "oauth",
  "client_url": "https://my_server.com/authorize",
  "scope": "",
  "authorization_url": "https://my_server.com/token",
  "authorization_content_type": "application/json",
  "verification_tokens": {
    "openai": "abc123456"
  }
},

To better understand the URL structure for OAuth, here is a short description of the fields:
为了更好地理解OAuth的URL结构,下面是字段的简短说明:

  • When you set up your plugin with ChatGPT, you will be asked to provide your OAuth client_id and client_secret
    当您使用ChatGPT设置插件时,系统会要求您提供OAuth client_idclient_secret
  • When a user logs into the plugin, ChatGPT will direct the user’s browser to "[client_url]?response_type=code&client_id=[client_id]&scope=[scope]&redirect_uri=https%3A%2F%2Fchat.openai.com%2Faip%2F[plugin_id]%2Foauth%2Fcallback"
    当用户登录插件时,ChatGPT会将用户的浏览器引导到 "[client_url]?response_type=code&client_id=[client_id]&scope=[scope]&redirect_uri=https%3A%2F%2Fchat.openai.com%2Faip%2F[plugin_id]%2Foauth%2Fcallback"
  • After your plugin redirects back to the given redirect_uri, ChatGPT will complete the OAuth flow by making a POST request to authorization_url with content type authorization_content_type and parameters { “grant_type”: “authorization_code”, “client_id”: [client_id], “client_secret”: [client_secret], “code”: [the code that was returned with the redirect], “redirect_uri”: [the same redirect uri as before] }
    在插件重定向回给定的redirect_uri之后,ChatGPT将通过使用内容类型 authorization_content_type 和参数 { “grant_type”: “authorization_code”, “client_id”: [client_id], “client_secret”: [client_secret], “code”: [the code that was returned with the redirect], “redirect_uri”: [the same redirect uri as before] }authorization_url 发出POST请求来完成OAuth流程

其它资料下载

如果大家想继续了解人工智能相关学习路线和知识体系,欢迎大家翻阅我的另外一篇博客《重磅 | 完备的人工智能AI 学习——基础知识学习路线,所有资料免关注免套路直接网盘下载》
这篇博客参考了Github知名开源平台,AI技术平台以及相关领域专家:Datawhale,ApacheCN,AI有道和黄海广博士等约有近100G相关资料,希望能帮助到所有小伙伴们。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/13766.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

第 三 章 UML 类图

文章目录 前言一、依赖关系(虚线箭头)二、泛化关系:继承(实线空心箭头)三、实现关系(虚线空心箭头)四、关联关系(一对一为实线箭头,一对多为实线)五、聚合关系…

KeePass搭建一个私人密码库

本文转载于我的博客KeePass搭建一个私人密码库 前言 {% note info no-icon %} 既然有人想看那我就不咕了嘻嘻 {% endnote %} 不知道在哪部电影里看到过这样一句话:根据社会工程学,正常人人脑是不会记住超过3种以上完全不同的复杂密码 所以你只要泄露一个…

Blender插件Lazy Viewport

目录 1.Lazy Viewport插件1.1 解压Lazy Viewport插件1.2 blender偏好设置1.3 打开插件1.4 安装插件1.5 勾选插件Lazy Viewport1.6 安装插件前1.7 安装插件后 1.Lazy Viewport插件 Blender 的一个简单插件,用于将标准 G、R、S 热键映射到视图工具,因此您…

一起学 WebGL:三角形加上渐变色

大家好,我是前端西瓜哥。之前教大家绘制一个红色的三角形,这次我们来画个有渐变的三角形。 本文为系列文章,请先阅读如何绘制红色三角形的文章: 《一起学 WebGL:绘制三角形》 原来的写法,颜色是在片元着色器…

分布式数据库架构路线大揭秘

文章目录 分布式数据库是如何演进的?数据库与分布式中间件有什么区别?如何处理分布式事务,提供外部一致性?如何处理分布式SQL?如何实现分布式一致性? 数据库更适合金融政企的未来 这些年大家都在谈分布式数…

成功上岸字节35K,技术4面+HR面,耗时20天,真是不容易

这次字节的面试,给我的感触很深,意识到基础的重要性。一共经历了五轮面试:技术4面+HR面。 下面看正文 本人自动专业毕业,压抑了五个多月,终于鼓起勇气,去字节面试,下面是我的面试过…

不知道今天吃什么?今天吃什么 API 告诉你

引言 在现代社会,由于生活节奏加快和繁忙的工作日程,越来越多的人感到选择今天吃什么餐点是一项繁琐且令人困扰的任务。为了解决这个问题,许多人会求助于在线菜谱和美食博客等渠道,但是这些选项通常是繁琐和耗时的。 幸运的是&a…

相参积累

原理 在探测远距离目标时,由于目标回波信号比较微弱,信号幅度很小,从而导致接收信号的信噪比(SNR)过低,以至于信号处理算法检测不到目标,从而发生漏检。 在脉冲体制雷达中,雷达系统…

公网远程访问局域网SQL Server数据库【无公网IP内网穿透】

目录 1.前言 2.本地安装和设置SQL Server 2.1 SQL Server下载 2.2 SQL Server本地连接测试 2.3 Cpolar内网穿透的下载和安装 2.3 Cpolar内网穿透的注册 3.本地网页发布 3.1 Cpolar云端设置 3.2 Cpolar本地设置 4.公网访问测试 5.结语 转发自CSDN远程穿透的文章&…

HoloLens2场景理解,识别平面信息

因为可用的资料比较少,就记录下吧,大家也可以少走弯路,节省时间。 场景理解,通俗的讲,可以识别空间当中的墙面、地板、天花板、平台等. 场景理解(Scene Understanding)是指 HoloLens2 通过深度传感器、摄像头和计算机视觉算法等技术,能够对…

微信小程序对接在线客服系统,对接小程序订阅消息模板,小程序订阅方法以及后端发送订阅模板消息的方法...

微信小程序想要对接独立在线客服系统,除了使用小程序消息推送接口外,还可以使用webview嵌入的形式嵌入聊天链接。 但是,使用webview嵌入的形式,当用户离开页面以后,就收不到客服回复的消息了 所以,我们需要…

Nginx快速上手~

注:本文针对官网的快速入门教程进行一个中文的解释,以帮助英文阅读能力较差的学习者快速上手 参考官网连接Beginners Guide (nginx.org) Centos下的安装 sudo yum install yum-utils # 创建文件 vim /etc/yum.repos.d/nginx.repo # 输入以下内容 ####…

IDEA插件-MavenHapler

1.安装Maven Helper Maven Helper 是 IntelliJ IDEA 中的一个插件,可以帮助您管理 Maven 依赖项。它可以帮助您更容易地删除不再需要的依赖项,查看依赖项的冲突,以及执行其他有关 Maven 依赖项的操作。 打开 IDEA 设置页面: 在插…

信息安全-reNgine-Web应用渗透测试的自动化网络侦察框架

目录 reNgine介绍 工具运行机制 安装部署 安装rengine 安装python依赖包 合并Django前端静态文件 安装Postgresql 创建reNgine账号 启动reNgine 启动reNgine成功 启动reNgine后在浏览器访问:http://localhost:8000/ 这时会发现前端静态资源加载失败&…

个人杂笔记

docker里面的-p暴露端口是确确实实写了才会映射到主机 docker run -d --hostname my-rabbit --name my-rabbit -e RABBITMQ_DEFAULT_USERroot -e RABBITMQ_DEFAULT_PASS250772730 -p 8080:8080 -p 15672:15672 -p 5672:5672 rabbitmq:3-managementpip安装提示warning 可能原因…

【C++】vector的简化模拟实现

文章目录 1. 主要结构2. 默认成员函数3. 迭代器4. 容量相关1. size和capacity2. reserve3. resize 5. 数据访问6. 数据修改1. push_back2.pop_back3. insert4.erase5.swap6.clear 1. 主要结构 参照SGI版本的vector实现,使用三个指针来维护这样一段内存空间 templa…

《数据结构》---术语篇

目录 前言: 一.术语 1.1数据 1.2数据结构 1.3逻辑结构和物理结构 二.数据类型和抽象数据类型 ​​​​​​​ ❤博主CSDN:啊苏要学习 ▶专栏分类:数据结构◀ 学习数据结构是一件有趣的事情,希望读者能在我的博文切实感受到&#xff0c…

同为科技(TOWE)防雷科普篇(二)——雷击灾害急救方法大全

前 言 当雷击发生时,空气中的各种微粒互相碰撞和摩擦便会使该空气介质两面的正负电荷的量持续积累,这时加于该空气介质的电压也会同时增加,当局部电压达到当时条件下空气的击穿电压时,该空气介质的局部便会发生电击穿而持续成为等…

使用ChatGPT完成程序开发——目标:不写一行代码完成图像识别并点击

本文作为一个使用AI开发的思路,让更多的人可以利用AI完成一些简单的程序,文中使用的是国内镜像GTP3.5 源码: GitHub - kasimshi/testCV: AI编写的OpenCV图像识别例子 GTP镜像: 知汇 对AI描述我们要做的功能,让它给给初步的思路和方向 作为新…

[译] 实战 React 18 中的 Suspense

> 原文:https://dev.to/darkmavis1980/a-practical-example-of-suspense-in-react-18-3lln React 18 带来了很多变化,它不会破坏你已经编写过的代码,并且有很多改进和一些新概念。 它也让很多开发人员,包括我,意识到…
最新文章