PasswordlessAPI
passwordlessapi
YOURLS允许API调用的老式的方法,使用用户名和密码参数(如果你的设置是私人的,很明显)。如果担心将证书发送到野外,还可以使用秘密签名令牌进行API调用。
签名的令牌
你的秘密签名的令牌将被一个这样的字符串 1002a612b4
一个秘密签名令牌是唯一的,与一个帐户关联,并且只能用于API请求。你会在你的页面找到它安装工具YOURLS。
注意:不能在工具页面看到这个签名吗?这可能是因为你安装的是公共。因此,不使用登录和密码来使用它。因此,没有使用签名令牌而不是登录/密码对。
签名令牌的使用
在你的API请求使用参数签名。例子:
http://yoursite/yourls-api.php?signature=1002a612b4&action=...
限时签名令牌的使用
您可以只在短时间内创建签名令牌(默认情况下一小时)。
首先,工艺时间有限的签名标记:
<?php
$timestamp = time();
$signature = md5( $timestamp . '1002a612b4' ); // 用你自己的秘密签名令牌替换。实例结果:
// Replace with your own secret signature token. Example result:
// $signature = "ed8d12124fc7916b00e3ecd7dc2c1d6a" ?>
现在在API请求中使用参数签名和时间戳。例子:
HTTP:+网站+yourls-api.php?+时间戳的时间戳和签名+签名+=…
http://yoursite/yourls-api.php?timestamp=$timestamp&signature=$signature&action=...
这个URL被有效期只有43200秒(12小时),常yourls_nonce_life默认值。
修改这个时间,添加以下你的config.php:
定义(“yourls_nonce_life ',number_of_seconds);
(注意这也影响所有YOURLS如激活插件的内部链接删除短网址,等..)
重置您的秘密签名令牌
如果因为某些原因你需要重置你的签名(即生成一个新的,以前的签名无效),简单地修改你的yourls_cookiekey config.php常数
PasswordlessAPI
YOURLS allows API calls the old fashioned way, using username and password parameters (if your setup is private, obviously). If you're worried about sending your credentials into the wild, you can also make API calls using a secret signature token.
Signature token
Your secret signature token will be a string like 1002a612b4
A secret signature token is unique, associated to one account, and can be used only for API requests. You will find it in the Tools page of your YOURLS install.
NB: Can't see this signature on the Tools page? It's probably because your install is public. Therefore, you don't use a login and password to use it. Therefore there's no signature token to be used instead of a login/password pair.
Usage of the signature token
Use parameter signature in your API requests. Example:
http://yoursite/yourls-api.php?signature=1002a612b4&action=...
Usage of a time limited signature token
You can create signature token valid for a short period only (one hour by default)
First, craft the time limited signature token:
<?php
$timestamp = time();
$signature = md5( $timestamp . '1002a612b4' );
// Replace with your own secret signature token. Example result:
// $signature = "ed8d12124fc7916b00e3ecd7dc2c1d6a"
?>
Now use parameters signature and timestamp in your API requests. Example:
http://yoursite/yourls-api.php?timestamp=$timestamp&signature=$signature&action=...
This URL would be valid for only 43200 seconds (12 hours), the default value of constant YOURLS_NONCE_LIFE .
To modify this duration, add the following to your config.php :
define( 'YOURLS_NONCE_LIFE', number_of_seconds );
(note this also affect all the internal links of YOURLS such as the ones to activate a plugin, delete a short URL, etc...)
Reset your secret signature token
If for some reason you need to reset your signature (ie to generate a new one while making previous signature inoperative), simply modify the YOURLS_COOKIEKEY constant in your config.php
PasswordlessAPI的更多相关文章
随机推荐
- android 视频
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 第一套完整版: 第二套完整版: 第三套完整版: 第四套完整版: 第五套完整版: ==== ...
- 在JSP使用EL中判断指定元素是否存在于指定集合中
在JSP使用EL中判断指定元素是否存在于指定集合中 1.问题描述 在JSP页面中使用EL表达式判断一个指定元素是否存在于指定集合中? 2.问题解决 eg:指定集合:collection:{1,2,3, ...
- codevs 1004 四子连棋
1004 四子连棋 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 在一个4*4的棋盘上摆放了14颗棋子,其中有7颗白 ...
- 浙江省队选拔 ZJOI2015 (Round 1) 解题报告
最近莫名其妙地喜欢上了用这种格式写各省省选的全套题解= = 今年浙江省选的出题人是算法竞赛界传说级人物陈立杰,看样子他的出题风格很有特点……ABC三题难度是严格递减的,感觉如果在做第一题的时候被卡住的 ...
- 【JavaScript代码实现二】通用的事件侦听器函数
// event(事件)工具集,来源:github.com/markyun markyun.Event = { // 页面加载完成后 readyEvent : function(fn) { if (f ...
- Codeforces Round #293 (Div. 2) B. Tanya and Postcard 水题
B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- Xcode 几个图标解释
File.让您指定串联图的常规信息. Quick Help.提供有关对象的实用文稿. Identity.让您指定对象的自定类并定义其辅助功能属性. Attributes.让您自定对象的可视化属性. S ...
- 在WPF中使用全局快捷键
今天写一个小程序中使用到了全局快捷键,找到了我之前写的文章在c#中使用全局快捷键翻了一下,发现它是WinForm版本的,而我现在大部分写WPF程序了,便将其翻译了为WPF版本的了. static cl ...
- android点滴之ContentObserver的使用
一概念 ContentObserver用于观察(捕捉)特定Uri引起的数据的变化,继而做一些对应的处理,当ContentObserver所观察的Uri发生变化时,便会触发它. 从概念看ContentO ...
- Linux下的两个经典宏定义 转
http://www.linuxidc.com/Linux/2016-08/134481.htm http://www.linuxidc.com/Linux/2013-01/78003.htm htt ...