dart-archive / googleapis_auth

Obtain OAuth 2.0 credentials to access Google APIs
https://pub.dev/packages/googleapis_auth
BSD 3-Clause "New" or "Revised" License
38 stars 26 forks source link

Initialize implicit browser flows statically. #55

Closed nichite closed 5 years ago

nichite commented 5 years ago

Static-ize logic dealing with loading the gapi JS library.

A single application can have multiple RPC services that hit different Google APIs, meaning they'll have multiple ImplicitFlows with different client configurations.

However, these deal with loading the gapi JS library (which can only ever be loaded once) in a non-static way, so multiple flows can try to load the library simultaneously. When that happens, the Future fails with an 'already completed' error.

By keeping track of a static pending initialization of the flow, we can ensure the library's only ever loaded once, no matter how many flow objects there are.

nichite commented 5 years ago

Thanks for the review! I can handle merging and publishing the package. I'll also sync to internal, so look out for another approval there if you have a sec.

nichite commented 5 years ago

Oops--just kidding, I don't have permissions to publish the pub package. Can you handle that?

jonasfj commented 5 years ago

No problem...

On Mon, 24 Jun 2019, 20.29 Nic Hite, notifications@github.com wrote:

Oops--just kidding, I don't have permissions to publish the pub package. Can you handle that?

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/dart-lang/googleapis_auth/pull/55?email_source=notifications&email_token=AABERZG46BFY2B7MR57E7C3P4EHAHA5CNFSM4H2Z7AY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYNZ3KY#issuecomment-505126315, or mute the thread https://github.com/notifications/unsubscribe-auth/AABERZA7LZLJDOYZAMLIGXTP4EHAHANCNFSM4H2Z7AYQ .

jonasfj commented 5 years ago

@nichite, Published as 0.2.8.