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

Authentication works in Dartium, but not when compiled with dart2js #53

Open
terrasea opened this issue Apr 17, 2014 · 0 comments
Open

Comments

@terrasea
Copy link

I'm putting it here first, to see if it's a problem with the library itself, but I suspect it's a overall Dart2JS problem.

I should be seeing a separate widow prompting me to login if I've not already, followed by a OAuth app permission request. This works when I run it in Dartium, but when I use

pub serve

executing it in Google Chrome.

What I get instead is:

Uncaught Error: NullError: Cannot call "closed" on null js_primitives.dart:25
Stack Trace: 
TypeError: Cannot read property 'closed' of undefined
    at _DOMWindowCrossFrame.get$closed (http://localhost:8080/index.dart.js:7527:32)
    at dart.J.get$closed$x (http://localhost:8080/index.dart.js:8807:39)
    at _WindowPoller.poll$0 (http://localhost:8080/index.dart.js:8425:13)
    at GoogleOAuth2_login_completeByPromptingUser_closure.call$1 (http://localhost:8080/index.dart.js:8126:56)
    at dart._rootRunUnary (http://localhost:8080/index.dart.js:3249:16)
    at _Future__propagateToListeners_handleValueCallback.call$0 (http://localhost:8080/index.dart.js:3627:47)
    at dart._Future.static._Future__propagateToListeners (http://localhost:8080/index.dart.js:3531:131)
    at _Future._completeWithValue$1 (http://localhost:8080/index.dart.js:3390:9)
    at _Future__asyncComplete_closure0.call$0 (http://localhost:8080/index.dart.js:3609:19)
    at _AsyncCallbackEntry.callback$0 (http://localhost:8080/index.dart.js:3769:28)
 js_primitives.dart:25
microtask error TypeError: Cannot read property 'closed' of undefined
    at _DOMWindowCrossFrame.get$closed (http://localhost:8080/index.dart.js:7527:32)
    at dart.J.get$closed$x (http://localhost:8080/index.dart.js:8807:39)
    at _WindowPoller.poll$0 (http://localhost:8080/index.dart.js:8425:13)
    at GoogleOAuth2_login_completeByPromptingUser_closure.call$1 (http://localhost:8080/index.dart.js:8126:56)
    at dart._rootRunUnary (http://localhost:8080/index.dart.js:3249:16)
    at _Future__propagateToListeners_handleValueCallback.call$0 (http://localhost:8080/index.dart.js:3627:47)
    at dart._Future.static._Future__propagateToListeners (http://localhost:8080/index.dart.js:3531:131)
    at _Future._completeWithValue$1 (http://localhost:8080/index.dart.js:3390:9)
    at _Future__asyncComplete_closure0.call$0 (http://localhost:8080/index.dart.js:3609:19)
    at _AsyncCallbackEntry.callback$0 (http://localhost:8080/index.dart.js:3769:28) js_primitives.dart:25
microtask error stack trace: Error
    at dart.wrapException (http://localhost:8080/index.dart.js:1835:15)
    at _rootHandleUncaughtError__closure.call$0 (http://localhost:8080/index.dart.js:3995:15)
    at _AsyncCallbackEntry.callback$0 (http://localhost:8080/index.dart.js:3769:28)
    at dart._asyncRunCallbackLoop (http://localhost:8080/index.dart.js:3152:13)
    at _asyncRunCallback (http://localhost:8080/index.dart.js:3161:9)
    at TimerImpl_internalCallback0.call$0 (http://localhost:8080/index.dart.js:1640:23)
    at invokeClosure_closure.call$0 (http://localhost:8080/index.dart.js:2644:29)
    at _IsolateContext.eval$1 (http://localhost:8080/index.dart.js:1042:23)
    at dart._callInIsolate (http://localhost:8080/index.dart.js:728:26)
    at invokeClosure (http://localhost:8080/index.dart.js:1963:16) 

I'm using the following Dart developer env

Dart Editor version 1.4.0.dev_02_02 (DEV)
Dart SDK version 1.4.0-dev.2.2

I was getting a similar error on the previous version 1.3.

Here is the pubspec.yaml file

name: google_plus_component
description: A pub package
dependencies:
  browser: any
  google_oauth2_client: any

Here's enough of the offending code

import 'package:google_oauth2_client/google_oauth2_browser.dart';

auth() {
  GoogleOAuth2 auth = new GoogleOAuth2(
      "client_id",
      ["https://www.googleapis.com/auth/plus.login"]
  );

  auth.ensureAuthenticated();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant