草庐IT

Writing-an-OAuth-Provider-Service

全部标签

php - Symfony2 : new instance at each service call instead of using the same

我创建了一个服务,但每次调用它时,它都会创建一个新实例,而不是使用同一个实例。这是我的services.yml:my.sessiondata:class:My\Bundle\Service\SessionDatacalls:-[setServices,[@security.context,@service_container,@session,@doctrine.orm.entity_manager]]scope:container还有我的服务:namespaceMy\Bundle\Service;classSessionData{protected$company;publicfun

PHP : Google plus Oauth 2. 0 - 获取 OAuth2 访问 token 时出错,消息: 'invalid_client'

使用PHPLibv2、Oauth2.0致力于使用Google登录。我花了很长时间终于配置好了,它曾经可以正常工作,但之后就不能用了。单击登录链接时,用户需要向Google进行身份验证。在此之前工作正常,身份验证完成。在使用GET变量回调时:?code=something&authuser=0&prompt=consent&session_state=something它正在生成以下错误:Fatalerror:Uncaughtexception'Google_AuthException'withmessage'ErrorfetchingOAuth2accesstoken,message:

PHP DOM 文档 : How do I get the value of an input field

如何使用PHP的DOMDocument获取没有ID属性的输入字段的值? 最佳答案 XPath让它变得简单,假设这是唯一以“make”作为名称的文本输入:$dom=newDOMDocument();$dom->loadHTML(...);$xp=newDOMXpath($dom);$nodes=$xp->query('//input[@name="make"]');$node=$nodes->item(0);$car_make=$node->getAttribute('value');如果页面上有多个具有该特定字段名称的输入(这完全有

php - 防护 'Google_Auth_Exception' 获取 OAuth2 访问 token 时出错,消息 : 'invalid_client' ' error

我正在尝试通过gmailapi从Google获取邮件在收到token后对Google_Client进行身份验证时出现此错误fatalerror:未捕获异常“Google_Auth_Exception”,消息“获取OAuth2访问token时出错,消息:‘invalid_client’”在我的代码使用google-api-php-client-master很简单,我的代码如下require_once('config.php');require_once'autoload.php';$client=newGoogle_Client();$client->setScopes(array('h

php - "Cannot use string offset as an array"错误

不知道这里出了什么问题。阅读人们在这里说的话:http://informationideas.com/news/2006/06/14/fatal-error-cannot-use-string-offset-as-an-array-in/在这里:Cannotusestringoffsetasanarrayinphp我在$entries(来自Google日历)中print_r()编辑了实际值,它们都很好。foreach($entriesas$e){$info=array();//addedtoseeifpre-declarationhelps$info=array($e['title']

php - 错误 :- php is not recognised as an internal or external command

关闭。这个问题是off-topic.它目前不接受答案。想改进这个问题吗?Updatethequestion所以它是on-topic用于堆栈溢出。关闭9年前。Improvethisquestion所以这是我的路径:C:\wamp\bin\php\php5.4.3我的php.exe文件在该文件夹中...我试着把:C:\wamp\bin\php\php5.4.3;C:\wamp\bin\php\php5.4.3\php.exeC:\wamp\bin\phpC:\wamp\bin\php;但没有一个是行不通的。我不知道为什么它不起作用......谢谢

PHP 简单 XML : How can I load an HTML file?

当我尝试使用simplexml_load_string将HTML文件加载为XML时我收到很多关于HTML的错误和警告,但它失败了,有没有办法使用SimpleXML正确加载html文件?这个HTML文件可能有不需要的空格,也可能有一些我希望SimpleXML忽略的其他错误。 最佳答案 使用DomDocument::loadHtmlFile和simplexml_import_dom将格式不正确的HTML页面加载到SimpleXML中。 关于PHP简单XML:HowcanIloadanHTML

php - 使用 OAuth 2.0 访问 Google API(特别是 Blogger)(PHP)

使用Google的教程,我尝试使用OAuth2.0身份验证方法访问BloggerAPI。我已成功通过OAuth身份验证,但我不明白如何访问API。他们所有的例子都基于对象$gdclient-如果你使用AuthSub方法,它被设置为Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);但是,如果您使用OAuth2.0进行身份验证,我似乎无法找到将$gdclient设置为什么!请帮忙?其余示例很简单,但正如我所提到的,它们都使用$gdclient,到目前为止我无法设置它。BloggerAPI教程:http://code.g

php - 将 OAuth WRAP 访问 token 直接保存在客户端计算机上的 cookie 中?

我打算建立一个可以访问oauthwrap框架的网站。我正在考虑将访问token按原样存储在客户端机器上。我不想在服务器上维护临时token等的数据库。我应该做什么?还是应该加密? 最佳答案 首先,他们为什么不使用OAuth2.0...您可以将OAuth凭据存储在cookie中,或者更好的是,在HTML5本地存储中。它应该被加密,以便只有服务器可以访问此cookie,并且只有服务器可以使用token。此外,它应该是一个安全的cookie,以防止它泄露出去。至少执行这两项中的一项(安全、加密)。但请记住,cookie可能会丢失,如果他们

PHP Google OAuth - 缺少方法?

我目前正在使用BuzzAPI做一些事情,我已经安装了GoogleApiPHP客户端库。当我运行它时,一切顺利,直到我收到一条错误消息:Fatalerror:CalltoundefinedmethodapiClient::getAccessToken()in(URL)online42我已经用Notepad++在所有文件中搜索了这个方法,但是没有一个声明。请问有人可以提供这个方法的源代码或者告诉我在哪里可以获得它吗? 最佳答案 这个函数调用的参数是什么?我为您找到了这个:gDataSample我重新打包它以便于外部使用:smarcomb