Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting multiple OAuth scopes via localhost HTTP receiver causes exception #1301

Closed
philipflesher opened this issue Oct 15, 2018 · 7 comments
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@philipflesher
Copy link

philipflesher commented Oct 15, 2018

When requesting a couple of scopes, there is no apparent issue. Requesting three scopes seems to cause the failure every time. This seems to be due to an arbitrarily short request line limit in the local server code receiver implementation - 256 bytes.

Exception received:

Exception has occurred: CLR/System.AggregateException
An exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'One or more errors occurred.'
 Inner exceptions found, see $exception in variables window for more details.
 Innermost exception 	 Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.LimitedLocalhostHttpServer.ServerException : Request line too long: > 256 bytes.
   at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.LimitedLocalhostHttpServer.<ReadRequestLine>d__14.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.LimitedLocalhostHttpServer.<GetQueryParamsFromClientAsync>d__13.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.LimitedLocalhostHttpServer.<GetQueryParamsAsync>d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.<GetResponseFromListener>d__17.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.<ReceiveCodeAsync>d__14.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.<AuthorizeAsync>d__8.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__1.MoveNext()

And here are the scopes that were requested:

        private static readonly string[] SCOPES = 
        {
            CloudResourceManagerService.Scope.CloudPlatformReadOnly,
            "https://www.googleapis.com/auth/cloud-billing.readonly",
            ComputeService.Scope.ComputeReadonly
        };
@chrisdunelm chrisdunelm self-assigned this Oct 16, 2018
@chrisdunelm chrisdunelm added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Oct 16, 2018
@chrisdunelm
Copy link
Contributor

Looks like this is causing problems now due to a change in auth server behaviour that has made the callback request URL longer.

@philipflesher
Copy link
Author

Thanks for the quick resolution @chrisdunelm!

@chrisdunelm
Copy link
Contributor

Thanks for reporting the bug.
v1.36.1 with the fix will be on nuget within 24 hours.

@philipflesher
Copy link
Author

Excellent! Although it seems there's a failing CI build now... 😢

@chrisdunelm
Copy link
Contributor

Thanks, yes. Looks like there's a test that's flaky on Linux.

@chrisdunelm
Copy link
Contributor

Flakiness fixed in #1305, v1.36.1 release is underway.

@philipflesher
Copy link
Author

Works perfectly after a test run. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants