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的更多相关文章

随机推荐

  1. MSSQL 基础知识与语句笔记

    建库 CREATE DATABASE 数据库名 ON[PRIMARY] --默认属于PRIMARY主文件组,可省略 ( NAME='', --主数据文件的逻辑名 名称 FILEAME='', --主数 ...

  2. luoguP5024 保卫王国 动态dp

    题目大意: emmmmm 题解: QAQ #include <cstdio> #include <cstring> #include <iostream> usin ...

  3. Git 简易使用指南及补充

    Git最简易的使用指南 助你开始使用 git 的简易指南,木有高深内容,;) 安装 下载 git OSX 版 下载 git Windows 版 下载 git Linux 版 创建新仓库 创建新文件夹, ...

  4. BZOJ 2142 礼物 组合数学 CRT 中国剩余定理

    2142: 礼物 Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1450  Solved: 593[Submit][Status][Discuss] ...

  5. Codeforces Round #254 (Div. 1) D. DZY Loves Strings hash 暴力

    D. DZY Loves Strings 题目连接: http://codeforces.com/contest/444/problem/D Description DZY loves strings ...

  6. 多线程面试题-sleep()和wait()区别

    sleep(): 1 .是Thread类中的一个方法,用于线程休眠, 2 .休眠时间结束后,该线程可以自动唤醒: wait(): 1. 是Object类中的一个方法,用于线程等待, 2. 如果想要唤醒 ...

  7. 使用postMessage进行react和iframe的数据通信.md

    将react的数据传递给iframe 1.首先在父组件(react文件)内引入iframe <iframe style={{border:0,width:"100%",hei ...

  8. 开发npm模块经验总结

    1.在windows下开发的package.json的bin链接的全局命令可能会在linux下报错:“没有那个文件或目录”之类的错误...此时可以在linux下用vim打开bin链接的js文件,设置s ...

  9. PostgreSQL修改数据库目录/数据库目录迁移

    说明:以9+版本为例,10+的版本只要把目录替换一下即可.迁移目录肯定是要停服的! 1.在数据库软件安装之后,初始化数据库时候,可以指定初始化时创建的数据库的默认文件路径 /usr/local/pgs ...

  10. SET XACT_ABORT ON 数据库事务

    转载:http://www.cnblogs.com/rob0121/articles/2320932.html SET XACT_ABORT ON SET XACT_ABORT ON分为两种: 1.总 ...