Authentication
是云端、网页和 SSH 访问函数的选项,允许给定认证参数.
更多信息
- Authentication 的可能设置包括:
-
Automatic 在 CloudConnect 凭据上的基础验证 <|"Username"…,…|> 给出用于认证的明确的用户名等 PermissionsKey["key"] 给出认证的权限密钥 SecuredAuthenticationKey[assoc] 给出 OAuth 安全认证密钥 assoc 插入 HTTP 请求中指定的显式元素 - 在 Authenticationassoc 形式中,关联 assoc 可含有以下元素:
-
"Username" 用于认证的用户名 "Password" 用于认证的密码 "Headers" 要发送到服务器的标头列表 "Query" HTTP 查询字符串或“参数-值”数据对列表 "SSHKey" SSH 标识符 "SSHKeyPassword" 用于解密 SSHKey 的密语字符串 - 可以用 "SSHKey" File[ident] 形式给出 SSH 标识符,其中 ident 是含有 SSH 私钥的文件. 也可用 "SSHKey" "string" 形式给出,其中 "string" 是 SSH 私钥.
范例
打开所有单元 关闭所有单元基本范例 (3)
部署权限授予 PermissionsKey 的云对象:
co = CloudDeploy[ExportForm["Hello", "Text"], Permissions -> PermissionsKey["key"] -> "Read"]对 Authentication 使用 PermissionsKey,读取云对象内容:
URLRead["https://www.wolframcloud.com/obj/d1362db4-d2b4-492e-bc60-090170c44d22", "Content", Authentication -> PermissionsKey["key"]]CopyFile[RemoteFile["sftp://host.example.com/tmp/test.m", Authentication -> <|"Username" -> "user", "SSHKey" -> File["/path/.ssh/id_rsa"]|>], "/tmp/test.m"]通过提供一组自定义的 Reddit 应用凭证,用 ServiceConnect 连接到 Reddit:
redditID = "myID";
redditSecret = "mySecret";redditKey = SecuredAuthenticationKey[<|"Name" -> "Reddit", "OAuthType" -> "AuthorizationCode", "OAuthVersion" -> "2.0", "ClientID" -> redditID, "ClientSecret" -> redditSecret, "Scopes" -> {"identity", "edit"}, "AccessTokenURL" -> "https://www.reddit.com/api/v1/access_token", "UserAuthorizationURL" -> "https://www.reddit.com/api/v1/authorize", "VerifierInputFunction" -> "WolframConnectorChannel"|>]reddit = ServiceConnect["Reddit", "New", Authentication -> redditKey]reddit["AccountData"]范围 (2)
连接到 Reddit API,用 OAuth 2.0 SecuredAuthenticationKey 进行身份验证:
redditID = "myID";
redditSecret = "mySecret";redditKey = SecuredAuthenticationKey[<|"Name" -> "Reddit", "OAuthType" -> "AuthorizationCode", "OAuthVersion" -> "2.0", "ClientID" -> redditID, "ClientSecret" -> redditSecret, "Scopes" -> {"identity", "edit"}, "AccessTokenURL" -> "https://www.reddit.com/api/v1/access_token", "UserAuthorizationURL" -> "https://www.reddit.com/api/v1/authorize", "VerifierInputFunction" -> "WolframConnectorChannel"|>]URLExecute["https://oauth.reddit.com/api/v1/me", Authentication -> redditKey]//Short连接到 Google Translate API,用 API 密钥进行身份验证:
googleAPIKey = "myGoogleAPIKey";URLExecute["https://translation.googleapis.com/language/translate/v2/languages", Authentication -> <|"Query" -> {"key" -> googleAPIKey}|>]//Short相关指南
-
▪
- URL 操作 ▪
- 云权限控制 ▪
- HTTP 请求与响应 ▪
- 网页操作 ▪
- 文件 ▪
- 文件操作 ▪
- 访问外部服务和 API ▪
- LLM 相关的功能
文本
Wolfram Research (2016),Authentication,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Authentication.html (更新于 2019 年).
CMS
Wolfram 语言. 2016. "Authentication." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2019. https://reference.wolfram.com/language/ref/Authentication.html.
APA
Wolfram 语言. (2016). Authentication. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/Authentication.html 年
BibTeX
@misc{reference.wolfram_2026_authentication, author="Wolfram Research", title="{Authentication}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/Authentication.html}", note=[Accessed: 11-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_authentication, organization={Wolfram Research}, title={Authentication}, year={2019}, url={https://reference.wolfram.com/language/ref/Authentication.html}, note=[Accessed: 11-August-2026]}