具有appAuth的Identity Server 4-如何在IDS4中为appAuthResponse设置AdditionalParameters

时间:2018-11-15 15:30:53

标签: oauth oauth-2.0 identityserver4 appauth

我们正在将React Native appAuth库(https://github.com/FormidableLabs/react-native-app-auth)与Identity Server 4一起使用,并尝试在响应上使用AdditionalParameters。原因是我们在IDS4登录页面上有一个语言选择器,我们希望将所选语言发送回本机应用程序,并让appAuth库接收到该语言,因此应用程序可以进行相应调整。 我如何修改Identity Server来做到这一点

return authorize(Auth.getConfig())
  .then(authDetails => {
    const { lang } = authDetails.additionalParameters;

    if (!lang) return authDetails;

    return Auth.setUserLang(lang, authDetails.accessToken).then(() => authDetails);
  })
  .then(authDetails => {
    store.dispatch(addAuth(authDetails));
    return authDetails;
  })
  .catch(e =>
    Auth.logout().then(() => {
      throw e;
    })
  );



static getConfig() {
const { apis: { identityServerURL } } = store.getState();

return {
  issuer: identityServerURL,
  clientId: IDENTITY_SERVER_CLIENT_ID,
  redirectUrl,
  additionalParameters: {},
  scopes: ['openid', 'profile', 'offline_access'],
  dangerouslyAllowInsecureHttpRequests: true,
};

}

我尝试使用ICustomAuthorizeRequestValidator

context.Result.ValidatedRequest.RedirectUri = $"{context.Result.ValidatedRequest.RedirectUri}?lang={context.Result.ValidatedRequest.UiLocales}";

,但这不适用于身份服务器错误     “错误”,“ MessageTemplate”:“无效的redirect_uri:{redirectUri},预期的{exceptRedirectUri}”,“属性”:{“ redirectUri”:“ icisapp:/ oauthredirect”,“ exceptRedirectUri”:“ icisapp:/ oauthredirect?lang = zh“

有人有什么主意吗?

0 个答案:

没有答案