/// <summary> /// Generates a consent URL that includes a set of provided parameters. /// </summary> /// <param name="scopes">A list of scope values that the user will need to authorize.</param> /// <param name="options">A table of optional authorization parameters to be encoded into the URL.</param> /// <returns>The generated login URL value.</returns> public string GetLoginUrl(IEnumerable <string> scopes, IDictionary <string, string> options) { LiveUtility.ValidateNotEmptyStringEnumeratorArguement(scopes, "scopes"); string locale = null; string state = null; DisplayType display = DisplayType.WinDesktop; ThemeType theme = ThemeType.Win7; string redirectUrl = LiveAuthUtility.BuildDesktopRedirectUrl(); if (options != null) { if (options.ContainsKey(AuthConstants.Locale)) { locale = options[AuthConstants.Locale]; } if (options.ContainsKey(AuthConstants.ClientState)) { state = options[AuthConstants.ClientState]; } if (options.ContainsKey(AuthConstants.Display)) { string displayStr = options[AuthConstants.Display]; if (!Enum.TryParse <DisplayType>(displayStr, true, out display)) { throw new ArgumentException(ErrorText.ParameterInvalidDisplayValue, "display"); } } if (options.ContainsKey(AuthConstants.Theme)) { string themeStr = options[AuthConstants.Theme]; if (!Enum.TryParse <ThemeType>(themeStr, true, out theme)) { throw new ArgumentException(ErrorText.ParameterInvalidDisplayValue, "theme"); } } } if (locale == null) { locale = CultureInfo.CurrentUICulture.ToString(); } return(this.authClient.GetLoginUrl(scopes, redirectUrl, display, theme, locale, state)); }