我有一个 API 服务器(资源服务器)和多个应用程序、Web GUI (SPA) 和一个桌面客户端,也许还有更多。除了我的 API 服务器的 http 基本身份验证之外,我还想使用 openid-connect。使用哪个 openid 提供程序应该是可配置的。我自己的,facebook,google……我只想做身份验证,我不需要他们的 API。我只需要一些个人资料数据,例如电子邮件或名字。
假设我已将 google 配置为我的 IdP,并且我目前正在使用我的 Web GUI (SPA)。我需要登录,没问题,根据https://developers.google.com/identity/protocols/OpenIDConnect我将用户重定向到谷歌,获取我的授权码,Web Gui (SPA) 从谷歌获取 id_token 和 access_token .
到目前为止没问题,但现在 SPA 必须与我的 API 服务器一起工作,并且 API 服务器需要验证来自客户端 (WebGui SPA) 的每个请求(因为它是一个无状态的休息 api)并且需要知道哪个用户实际上做了这个。
一种
那么来自 google 的 access_token 是用来访问 google api 的吗?但我也可以将这个 access_token 与每个请求一起传递给我的 api 服务器,api 服务器调用https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=xxx来验证 access_token 并获取帐户名(邮件)。但这听起来不对,是吗?
乙
我也有 id_token 可以验证,而无需每次都调用谷歌服务器。那么我是否也可以将 id_token 作为承载传递给我的 api 服务器,而 api 服务器可以验证 id_token?但是根据 openid-connect 规范, access_token 实际上是刚刚传递给 api 服务器的那个,而 id_token 必须保留在客户端上。但是 id_token 对我来说完全没用,API …
api oauth-2.0 single-page-application openid-connect google-openidconnect
我正在用javascript编写游戏.这个应用程序在我的浏览器上运行良好(快速),但我用android webview运行它有一些麻烦.
在游戏菜单中,我有一个方法,如:
this.showCredits = function() {
document.getElementById('core-credits-layer').style.display = 'block';
document.getElementById('core-credits').style.display = 'block';
var parent = this;
$.ajax({
url: 'content/credits.html',
dataType: 'html',
success: function(data, status, response) {
var now = new Date();
var s = now.getSeconds()-parent.test.getSeconds();
console.log('success ajax: '+s);
document.getElementById('core-credits').scrollTop = 0;
document.getElementById('core-credits').innerHTML = response.responseText;
console.log('finished');
},
error: function() {
console.error('failed fetch credits');
}
});
}
Run Code Online (Sandbox Code Playgroud)
因此,在单击"信用"菜单后立即出现控制台日志("已完成",成功的最后一行()).但是在我看到div #core-credits之前,它可能需要6s(或多或少).在我的浏览器中,我点击后立即看到#core-credits.但第二次点击该菜单点我在1-2s之后得到了div.我现在不知道那是什么,我不这么认为,这是一个缓存的事情,因为我很快就进入了success()回调.
Java方面:
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Context context = this.getApplicationContext();
SharedPreferences wmbPreference = PreferenceManager.getDefaultSharedPreferences(this);
boolean isFirstRun = wmbPreference.getBoolean("FIRSTRUN", …Run Code Online (Sandbox Code Playgroud) 如果我在 WebView 应用程序中播放曲目(它可以与 PlayerPro 等其他播放器配合使用),Android 会暂停默认音乐播放器中的音乐曲目,这是否正常?
播放曲目:
音频=新音频(路径);
音频.播放();
play() 之后,我的音乐播放器中的曲目暂停
我猜 webview 采用与默认音乐播放器相同的 api,但是有解决方法吗?
我正在尝试oauth2在我们的API中实现基本身份验证。
我已经构建了一个身份验证服务器,并在API#1和API Server#2中实现了访问令牌验证。
所以我的问题是,如何oauth2与多个API一起使用?
目前,我可以通过一个access_token访问所有API,但是我想这应该不是...,还是我误会了什么?
而且我不确定scopes参数,这更多是权限问题,并且未指定访问令牌应发布给哪个api。