diff --git a/Octokit.Tests/Clients/OauthClientTests.cs b/Octokit.Tests/Clients/OauthClientTests.cs index b4155f9abf..1bb680e61e 100644 --- a/Octokit.Tests/Clients/OauthClientTests.cs +++ b/Octokit.Tests/Clients/OauthClientTests.cs @@ -44,8 +44,10 @@ public void ReturnsUrlWithAllParameters() var request = new OauthLoginRequest("secret") { RedirectUri = new Uri("https://example.com/foo?foo=bar"), + Login = "johnDOE", Scopes = { "foo", "bar" }, - State = "canARY" + State = "canARY", + AllowSignup = false }; var connection = Substitute.For(); connection.BaseAddress.Returns(new Uri("https://api.github.com")); @@ -54,7 +56,7 @@ public void ReturnsUrlWithAllParameters() var result = client.GetGitHubLoginUrl(request); Assert.Equal("/login/oauth/authorize", result.AbsolutePath); - Assert.Equal("?client_id=secret&redirect_uri=https%3A%2F%2Fexample.com%2Ffoo%3Ffoo%3Dbar&scope=foo%2Cbar&state=canARY", result.Query); + Assert.Equal("?client_id=secret&redirect_uri=https%3A%2F%2Fexample.com%2Ffoo%3Ffoo%3Dbar&login=johnDOE&scope=foo%2Cbar&state=canARY&allow_signup=false", result.Query); } } diff --git a/Octokit/Models/Request/OauthLoginRequest.cs b/Octokit/Models/Request/OauthLoginRequest.cs index 54fe1911f7..5c4a3b48ad 100644 --- a/Octokit/Models/Request/OauthLoginRequest.cs +++ b/Octokit/Models/Request/OauthLoginRequest.cs @@ -40,6 +40,12 @@ public OauthLoginRequest(string clientId) [Parameter(Key = "redirect_uri")] public Uri RedirectUri { get; set; } + /// + /// Suggests a specific account to use for signing in and authorizing the app. + /// + [Parameter(Key = "login")] + public string Login { get; set; } + /// /// A set of scopes to request. If not provided, scope defaults to an empty list of scopes for users that don’t /// have a valid token for the app. For users who do already have a valid token for the app, the user won’t be @@ -60,6 +66,13 @@ public OauthLoginRequest(string clientId) [Parameter(Key = "state")] public string State { get; set; } + /// + /// Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. + /// The default is true. Use false in the case that a policy prohibits signups. + /// + [Parameter(Key = "allow_signup")] + public bool? AllowSignup { get; set; } + internal string DebuggerDisplay { get