public Uri AuthenticationUri(string redirectUri, IList<string> scopes) { var uriBuilder = new StringBuilder(); uriBuilder.Append(redirectUri); uriBuilder.Append("?code=FakeCode&"); var state = new AuthState { Scopes = scopes }; uriBuilder.Append("&state="); uriBuilder.Append(state.ToUrlEncoded()); return new Uri(uriBuilder.ToString()); }
public Uri AuthenticationUri(string redirectUri, IList<string> scopes) { var uriBuilder = new StringBuilder(); uriBuilder.Append("https://accounts.google.com/o/oauth2/auth"); uriBuilder.Append("?scope="); var scopeSsv = string.Join(" ", scopes); uriBuilder.Append(HttpUtility.UrlEncode(scopeSsv)); uriBuilder.Append("&redirect_uri="); uriBuilder.Append(HttpUtility.UrlEncode(redirectUri)); uriBuilder.Append("&response_type=code"); uriBuilder.Append("&client_id="); uriBuilder.Append(_clientId); var state = new AuthState { RedirectUri = redirectUri, Scopes = scopes }; uriBuilder.Append("&state="); uriBuilder.Append(state.ToUrlEncoded()); return new Uri(uriBuilder.ToString()); }