我有一个angular和Node(带有快速框架)应用程序。我正在使用okta进行身份验证。这个有角度的应用程序打开了不同的查询参数,例如。 www.mysite.com/home?tab=1。我有角度的设置路由,该路由根据tab的值打开不同的页面。但是在Okta中,重定向URL必须是静态的,因此我将重定向URL设置为www.mysite.com/home。 okta重定向回应用程序后,查询参数信息将丢失。我如何在节点js中获取tab = 1。我正在使用通行证和passport-openidconnect。
app.use(
session({
secret: crypto.randomBytes(64).toString('hex').substring(0, 20),
resave: true,
saveUninitialized: true,
})
);
app.use(passport.initialize());
app.use(passport.session());
passport.use(
'oidc',
new OidcStrategy(
{
issuer: '',
authorizationURL: 'xxxx',
tokenURL: 'xxxx',
userInfoURL: 'xxxx',
clientID: 'xxxx',
clientSecret: 'xxxx',
callbackURL: 'xxxx',
scope: 'profile groups',
nonce: crypto
.randomBytes(64)
.toString('hex')
.substring(0, 20),
},
(issuer, sub, profile, accessToken, refreshToken, params, done) => {
return done(null, profile);
}
)
);
app.use('/ mdi',passport.authenticate('oidc'))
您需要向后端发出另一个请求,以获取有关该用户的更多信息。这对于获取确定用户需要显示的选项卡的数据很有用。例如:您可以向后端“ www.yourbackend / me”发送请求,并在此端点中根据会话返回制表符值。另一种可能性是让jwt的有效载荷中包含用户数据,但是,采用这种方法,您在后端不再有会话。