We are using the React Native appAuth library(https://github.com/FormidableLabs/react-native-app-auth) with Identity Server 4. and attempting to make use of the additionalParameters on the response. The reason for this is we have a language selector on the IDS4 login page and we wish to send the selected language back to the Native app and have the appAuth library receive this, so the app can adjust accordingly. How do i modify Identity Server to do this
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,
};
}
I have tried using ICustomAuthorizeRequestValidator
context.Result.ValidatedRequest.RedirectUri = $"{context.Result.ValidatedRequest.RedirectUri}?lang={context.Result.ValidatedRequest.UiLocales}";
but this does not work as identity server errors with "Error","MessageTemplate":"Invalid redirect_uri: {redirectUri}, expected {exceptRedirectUri}","Properties":{"redirectUri":"icisapp:/oauthredirect","exceptRedirectUri":"icisapp:/oauthredirect?lang=zh"
Anybody have any ideas?