c# - 从身份服务器 url 读取参数
问题描述
我在 IIS 服务器上托管的 asp.net 中有一个身份服务器,并且我已经注册了一个这样的客户端
public static IEnumerable<Client> Get()
{
return new[]{
new Client
{
Enabled = true,
ClientName = "MyClient",
ClientId = " uniqueclientId",
Flow = Flows.Implicit,
AccessTokenType = AccessTokenType.Jwt,
RedirectUris ={"http://localhost:3000/callback"},
PostLogoutRedirectUris = new List<string>
{
clientBaseURL+"/index.html"
},
AllowedCorsOrigins = new List<string>
{
clientBaseURL
},
AllowAccessToAllScopes = true,
AccessTokenLifetime = TokenExpiryTimeInSeconds,
AllowAccessTokensViaBrowser = true,
AlwaysSendClientClaims = true,
RequireConsent=false
},
new Client {....}
}
我正在使用护照包在我的nodejs应用程序中调用它。身份验证后,我在回调 url 中收到的值是http://localhost:3000/callback#id_token=someidtoken&access_token=someaccesstoken
我试图读取的值
app.get('/callback',passport.authenticate('openidconnect', { failureRedirect: '/login' }),
function(req, res) {
console.log(req)
res.redirect('/');
});
这是来自 strategy.js 的一部分passport-openidconnect
meta.callbackURL = callbackURL;
var params = self.authorizationParams(options);
params['response_type'] =["id_token token"];
params['client_id'] = config.clientID;
if (callbackURL) { params.redirect_uri = callbackURL; }
var scope = options.scope || self._scope;
if (Array.isArray(scope)) { scope = scope.join(' '); }
if (scope) {
params.scope = 'openid ' + scope;
} else {
params.scope = 'openid';
}
但是我不能点击这个 URL,因为查询字符串中有参数(#
在 url 中也有一个)。如何在我的节点 js 应用程序中阅读此内容?我错过了什么吗?
解决方案
推荐阅读
- python - tf.keras model.predict 导致内存泄漏
- python - 进行 FFT 时提取主频返回错误的频率
- javascript - 如何在 p5.js 画布中放置交互式文本?
- woocommerce - WooCommerce 产品库编辑图片
- flutter - 重新加载小部件树时未重新创建颤振 BlocProvider
- python - 为什么我的函数在通过 if 语句时不起作用?
- java - while((message = reader.readLine()) != null) 是无限循环吗?
- javascript - 如何将文本文件读入 JavaScript 中的对象数组
- javascript - Quill 富文本编辑器:如何将文件输入按钮附加到工具栏并嵌入到编辑器
- javascript - 如何设置状态