我正在尝试使用护照模块在我的网络应用程序上设置twitter连接
我已经实现了如下:
App.js文件:
/**
* Module dependencies.
*/
var express = require('express');
var user = require('./server/routes/user');
var http = require('http');
var path = require('path');
var app = express();
var passport = require('passport');
var flash = require('connect-flash');
require('./server/config/passport')(passport); // pass passport for configuration
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.configure(function() {
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(app.router);
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public')));
// set up our express application
app.use(express.logger('dev')); // log every request to the …Run Code Online (Sandbox Code Playgroud) 用户可以使用他们的LinkedIn帐户登录我的Rails应用程序,这要归功于OAuth.但是,我在显示用户的个人资料图片时遇到问题.以下网址未加载图片:
<%= image_tag("http://api.linkedin.com/v1/people/{user-id}/picture-url") %>
如何让用户的LinkedIn个人资料图像显示在我的Rails应用程序中?
谢谢!
我试图在Ubuntu Server 12.04上安装OAuth但是收到错误.我正在按照本教程进行操作,但是有些东西没有排队:
http://sergiopvilar.wordpress.com/2013/05/18/how-to-install-php-oauth-extension/
命令我在终端中运行:
sudo pecl install oauth
Run Code Online (Sandbox Code Playgroud)
我得到响应的最后一部分错误(因为它返回几页响应):
running: make
/bin/bash /tmp/pear/temp/pear-build-rootFgGDRe/oauth-1.2.3/libtool --mode=compile cc -I. -I/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootFgGDRe/oauth-1.2.3/include -I/tmp/pear/temp/pear-build-rootFgGDRe/oauth-1.2.3/main -I/tmp/pear/temp/oauth -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /tmp/pear/temp/oauth/oauth.c -o oauth.lo
libtool: compile: cc -I. -I/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootFgGDRe/oauth-1.2.3/include -I/tmp/pear/temp/pear-build-rootFgGDRe/oauth-1.2.3/main -I/tmp/pear/temp/oauth -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /tmp/pear/temp/oauth/oauth.c -fPIC -DPIC -o .libs/oauth.o
In file included from /tmp/pear/temp/oauth/php_oauth.h:47:0,
from /tmp/pear/temp/oauth/oauth.c:14:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
compilation …Run Code Online (Sandbox Code Playgroud) 我从githhub的API服务器使用了OAuth2代码:https://github.com/lucadegasperi/oauth2-server-laravel
我想使用Sentry,而不是使用标准的Laravel Auth,因为Sentry具有许多用于发送邮件,禁止,批准注册,...的功能。
我在API服务器上成功从客户端(带有Guzzle插件的Laravel)创建了连接,但无法保持Sentry会话。可以吗?如何知道API服务器上的权限,组或任何我的用户。对于每个调用API,我都会发送access_token,但对于OAuth2而言已足够。我不知道如何保持Sentry会话,例如:
我以主持人权限用户身份登录,并且向API发送新请求以获取一些主持人信息,因为我没有Sentry会话,所以我不知道它是主持人还是管理员或其他身份。
也许oauth:scope1,scope2就足够了,也许我不需要Sentry,但是我没有Sentry功能(请看这篇文章的开头)。
我相信我的问题微不足道,但是我不知道如何解决此问题。我一点主意都没有 :(
在阅读此实施OAuth 2.0身份验证(服务器端)时,我注意到该流程可能适用于创建应用程序的情况,该应用程序允许用户使用其Google凭据登录并随后显示其Google+帖子,Youtube视频等.
我需要的是能够根据谷歌用户的用户名或用户ID获取谷歌数据.我确实有来自Google的client_id,client_secret等 - 而且我愿意按照我的要求发送它们.
第1步似乎没问题.提出类似这样的请求:
https://accounts.google.com/o/oauth2/auth?
client_id=1084945748469-eg34imk572gdhu83gj5p0an9fut6urp5.apps.googleusercontent.com&
redirect_uri=http%3A%2F%2Flocalhost%2Foauth2callback&
scope=https://www.googleapis.com/auth/youtube&
response_type=code&
access_type=offline
Run Code Online (Sandbox Code Playgroud)
在这一步之后可能会有什么好处,只需要获取代码,以便我可以验证我的请求(通过Google_Client() - > authenticate($ _ GET ['code']);或类似的),然后将其交换为auth_token.
我使用Facebook API for PHP获得类似于获取Facebook个人资料/页面公共帖子的内容 - 因此与FB流程的登录不同 - 不需要用户同意也不需要用户同意.
我正在添加使用oauth2在iOS 7应用程序中在LinkedIn上分享文章的功能.我已经通过身份验证并拥有访问令牌.文档似乎很清楚,但实际上发布的事情很奇怪,事情变得非常模糊和记录不清.我知道我在这里发帖:http://api.linkedin.com/v1/people/~/shares附加令牌.
iOS是一个巨大的平台,而且很受欢迎,我认为我错过了一些明显的东西,但很多谷歌搜索都揭示了旧项目的旧参考.一个例子使用oauth2并确实通过身份验证,但我不能进行任何api调用.我错过了本身的页面吗?我已经阅读了分享api页面,但是当谈到api调用时,使用objective-c并不是一个例子.我不打算什么都不做,但我只是对缺乏信息感到惊讶.
每个示例都使用OAMutableRequest,构建字典等相同的代码.但他们从不解释那是什么,如何整合那个图书馆或任何东西,它只是奇怪.这是公认的最佳实践,图书馆在3年内没有更新,因此它有弧形和其他东西的错误.所有代码示例都提到了相同的"消费者"属性,没有讨论如何或为什么需要这样做.我似乎无法找到如何使用参数linkedin构建post请求,以便在网站上发布内容.OAMutableRequest是唯一的方法吗?如果是这样,人们如何更新它的工作?如果没有,您如何使用NSURLRequest或更简单的方法构建请求.非常感谢!
Twitter为他们的api提供仅限应用程序的身份验证:https://dev.twitter.com/docs/auth/application-only-auth
Twitter为应用程序提供代表应用程序本身发出经过身份验证的请求的能力(而不是代表特定用户)
我想在Rails中对门卫做同样的事情,但我不知道该怎么做.似乎只能通过回调网址对用户进行身份验证,但如何使用应用程序上下文访问我的API(仅使用应用程序ID和应用程序密钥)
我的第一个想法是使用应用程序的ID和密码进行密码凭证登录,以获取属于该应用程序的访问令牌.这是一个坏主意吗?从安全的角度来看是否安全?我想知道因为应用程序的秘密在db中保存为纯文本,这是用户身份验证的禁忌.
我正在尝试关注一些通过python代码在LinkedIn上注册的公司,并且根据LinkedIn API文档, 我需要使用oauth2-POST方法来关注公司。
我的查询如下:
我的代码如下:
oauth_token = oauth.Token(key=access_token_key, secret=access_token_secret)
oauth_consumer = oauth.Consumer(key=api_key, secret=api_secret)
signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1()
http_method = "POST"
http_handler = urllib.HTTPHandler(debuglevel=_debug)
https_handler = urllib.HTTPSHandler(debuglevel=_debug)
def linkedinreq(url, method, parameters):
req = oauth.Request.from_consumer_and_token(oauth_consumer,
token=oauth_token,
http_method=http_method,
http_url=url,
parameters=parameters)
req.sign_request(signature_method_hmac_sha1, oauth_consumer, oauth_token)
req.to_postdata()
def fetchsamples():
url = "https://api.linkedin.com/v1/people/~/following/companies"
parameters = []
response = linkedinreq(url, "POST", parameters)
fetchsamples()
Run Code Online (Sandbox Code Playgroud) 我需要构建一个连接到Google日历并获取指定事件集的小型Web应用程序.我已经阅读了文档,我了解到我需要对用户进行身份验证,这是我在Google Developer Console上创建的应用程序.
我正在尝试使用弹出窗口实现身份验证(我正在使用fancybox).这是<div>登录数据的来源:<div id="login-popup" style="display:none"></div>
这是我用来调用auth.php文件的JS代码:
$.get("/auth.php", function(result) {
$('#login-popup').append(result);
$.fancybox({
href: "#login-popup",
autoSize: true,
width: "60%",
fitToView: true
});
});
Run Code Online (Sandbox Code Playgroud)
最后,这是将GET请求发送到Google API的PHP代码:
$ch = curl_init();
if($ch) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $query);
$result = curl_exec($ch);
curl_close($ch);
}
else {
throw new RuntimeException("Hiba történt a távoli adatok elérése közben!");
}
echo json_encode($result);
Run Code Online (Sandbox Code Playgroud)
所以这个弹出窗口会在此之后出现,因为它应该是:

但是,在我输入凭据后,它会将我重新搜索到Google的登录网站(https://accounts.google.com/ServiceLoginAuth).
我的问题:
我需要能够从这个弹出窗口中获取数据,以获取我以后可以在Calendar API调用中使用的访问令牌.我需要做些什么来实现这一目标?
一旦我被引导到Facebook,Google或Twitter进行身份验证并提供我的凭据,那么在我被重定向的时候,所有显示的都是白屏.我想说它不会将我重定向到我的应用程序.
顺便说一下,当我在Galaxy S5手机上运行我的Ionic应用程序时会发生这种情况.当我在笔记本电脑上的Chrome上运行时,重定向工作正常.
这是我的代码.
ref.authWithOAuthPopup(provider, function(error, authData) {
if(authData){
$timeout(function(){
$location.path('tab/profile');
}, 1000);
} else {
$ionicPopup.alert({
title: 'Error',
template: 'Try logging in again.'
});
console.log(error);
}
});
Run Code Online (Sandbox Code Playgroud) oauth ×10
php ×3
google-api ×2
linkedin ×2
doorkeeper ×1
firebase ×1
google-oauth ×1
ios ×1
javascript ×1
laravel ×1
networking ×1
node.js ×1
oauth-2.0 ×1
objective-c ×1
passport.js ×1
post ×1
python ×1
rest ×1
twitter ×1
ubuntu ×1