Eventful.com OAuth在Coldfusion中

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authorize a script to access Eventful to download their events.

我花了将近三天的时间来弄清楚如何将OAuth整合到Eventfusion API的Coldfusion中。 希望本文可以使Coldfusion程序员在需要时通过API进行讨论。 基本上,此脚本的作用是授权脚本访问Eventful以下载其事件。

What is OAuth?

什么是OAuth?

According to Wikipedia, OAuth (Open Authorization) is an open standard that allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their credentials, typically username and password.

根据Wikipedia的说法,OAuth(开放授权)是一种开放标准,允许用户与另一个站点共享存储在一个站点上的私有资源(例如照片,视频,联系人列表),而无需发放凭据(通常是用户名和密码)。

Let's talk about the code below:

让我们来谈谈下面的代码:

The following code generates the HMAC-SHA1 authentication code required by OAuth. Contrary to ColdFusion's documentation, HMAC-SHA1 is not supported by the Encrypt (or Hash) functions.  The workaround is a simple HMAC-SHA1 CFFunction

以下代码生成OAuth所需的HMAC-SHA1身份验证代码。 与ColdFusion的文档相反,加密(或哈希)功能不支持HMAC-SHA1。 解决方法是简单的HMAC-SHA1 CFFunction

HMAC Function

The next bit of code generates the OAuth "base string" from the parameters of your OAuth request.

下一部分代码从OAuth请求的参数生成OAuth“基本字符串”。

OAuth BaseString Function

Next, we enhance ColdFusion's URLEncoded() function to produce strings compliant with RFC 3986. ColdFusion's URLEncodedFormat function is not 100% compliant with RFC 3986 and will trip up OAuth's sensitive string calculations.

接下来,我们增强ColdFusion的URLEncoded()函数以生成符合RFC 3986的字符串。ColdFusion的URLEncodedFormat函数并非100%符合RFC 3986,并且会使OAuth的敏感字符串计算失败。

Enhanced URLEncode Function

This is the engine of the OAuth car. Generates the OAuth request header and signature, submits to the provider (e.g., Twitter) and returns the response in a string. In accordance with the OAuth specification, the callback URL is twice URL encoded.

这是OAuth汽车的引擎。 生成OAuth请求标头和签名,提交给提供者(例如Twitter),并以字符串形式返回响应。 根据OAuth规范,回调URL进行了两次URL编码。

OAuth Authorization Function

At the end of this code, you should have the access token and token secret

在此代码的结尾,您应该具有访问令牌和令牌密钥

Code that Calls Functions

In case anybody wants to use this code, I am attaching a file with all code contained in this lesson at the bottom.

如果有人要使用此代码,我将在本课程的底部附加一个文件,其中包含本课程中的所有代码。

A special thanks goes out to Dave Delbridge for his OAuth implement with Twitter. This made my eventful script possible. In addition, special thanks to David Reiter from eventful.com for helping solve the OAuth authorization

特别感谢Dave Delbridge使用Twitter的OAuth工具。 这使我多事的脚本成为可能。 此外,特别感谢eventful.com的David Reiter帮助解决OAuth授权

If you have any questions, please feel free to comment below and I will get back to you as soon as possible. Thank you for taking time to read my first article on experts-exchange!

如有任何疑问,请随时在下方评论,我们会尽快与您联系。 感谢您抽出宝贵的时间阅读我的第一篇有关“专家交流”的文章!

This article is part of my Coldfusion Development Project.

本文是我的Coldfusion开发项目的一部分。

code.docx 代码.docx

翻译自: https://www.experts-exchange.com/articles/12250/Eventful-com-OAuth-in-Coldfusion.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值