dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
30 stars 21 forks source link

Using with Chrome #332

Open TheMchurch opened 4 years ago

TheMchurch commented 4 years ago

Hi, the plugin is working perfectly with iOS and Android. I was running my app under web develop mode, with Chrome, but I have 1 error calling:

var client = await oauth2.resourceOwnerPasswordGrant
        authorizationEndpoint, username, password,
        identifier: identifier, secret: secret, basicAuth: false);

Error: Error: XMLHttpRequest error. package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 248:20 get current package:http/src/browser_client.dart 84:22 package:dart-sdk/lib/async/zone.dart 1381:54 runUnary package:dart-sdk/lib/async/future_impl.dart 140:18 handleValue package:dart-sdk/lib/async/future_impl.dart 682:44 handleValueCallback package:dart-sdk/lib/async/future_impl.dart 711:32 _propagateToListeners package:dart-sdk/lib/async/future_impl.dart 516:7 [_complete] package:dart-sdk/lib/async/stream_pipe.dart 65:11 _cancelAndValue package:dart-sdk/lib/async/stream.dart 1253:11 package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 326:14 _checkAndCall package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 331:39 dcall package:dart-sdk/lib/html/dart2js/html_dart2js.dart 35657:58 .......

Thanks for your help.

fvisticot commented 4 years ago

I'm interested as well to get oAuth support for WEB application. BUT it seems that oAuth workflow is different when used for WEB application (due to security reason). In case of WEB (PWA application) it seems required to use oAuth implicit workflow or PKCE

https://medium.com/oauth-2/why-you-should-stop-using-the-oauth-implicit-grant-2436ced1c926
https://aaronparecki.com/oauth-2-simplified/

TheMchurch commented 4 years ago

Thank you very much. I’ll read it for sure. Merry Christmas!

Il giorno mer 25 dic 2019 alle 23:23 fvisticot notifications@github.com ha scritto:

I'm interested as well to get oAuth support for WEB application. BUT it seems that oAuth workflow is different when used for WEB application (due to security reason). In case of WEB (PWA application) it seems required to use oAuth implicit workflow or PKCE

https://medium.com/oauth-2/why-you-should-stop-using-the-oauth-implicit-grant-2436ced1c926 https://aaronparecki.com/oauth-2-simplified/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/tools/issues/332?email_source=notifications&email_token=AAS56DNQICKA3SSZ6IDEEVLQ2PMOVA5CNFSM4J6MXPQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHUUGCQ#issuecomment-568935178, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS56DP4FLUCSVYT2GJIAQLQ2PMOVANCNFSM4J6MXPQA .

-- Sent from Gmail Ipad

jonasfj commented 4 years ago

Writing up a minimal example that works with dart2js in the browser is a good start to fixing this.

I suspect you might be running into a CORS issue or browser security issue. Maybe your oauth2 server is missing some headers to allow requests. Or maybe we're sending some headers that we don't need to be sending in the browser context.