Reputation: 77
I added the shared localization in Identity Server 4 Core 2.2 (https://damienbod.com/2017/11/01/shared-localization-in-asp-net-core-mvc/comment-page-1/#comment-21394).
https://my.domain.com/Account/Register?culure=xx-YY&ui-culture=xx-YY is working.
Now, how can I pass the culture and iu-culture parameters to my IdendityServer with the OidClient LoginAsync() in the native app?
var options = new OidcClientOptions
{
Authority = "https://my.domain.com",
ClientId = "hybrid",
ClientSecret = "secret",
Scope = "openid profile api offline_access",
ResponseMode = OidcClientOptions.AuthorizeResponseMode.Redirect,
RedirectUri = "myscheme://signin-oidc",
PostLogoutRedirectUri = "myscheme://signout-callback-oidc",
Browser = new PlatformWebView()
};
_client = new OidcClient(options);
var result = await _client.LoginAsync(new LoginRequest());
Thank you.
Upvotes: 2
Views: 2255
Reputation: 11568
One option is to add support for the OIDC optional parameter called ui_locales. Damien Bod has a post on this as well: identityserver4-localization-using-ui_locales-and-the-query-string
To pass the ui_locales from your client to the identityserver you can use FrontChannelExtraParameters
property of the LoginRequest
.
Parameters added to the FrontChannelExtraParameters
of the LoginRequest
will be added to the end of the authorize URL.
If you change the last line of your code to this:
var result = await _client.LoginAsync(
new LoginRequest{ FrontChannelExtraParameters = new { ui_locales = "en-US" }} );
The authorize request should look something like this:
"https://demo.identityserver.io/connect/authorize?response_type=code&nonce=20c640......&ui_locales=en-US"
Upvotes: 3