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

Angular Universal #440

Closed
doczoidberg opened this issue Aug 16, 2016 · 3 comments
Closed

Angular Universal #440

doczoidberg opened this issue Aug 16, 2016 · 3 comments

Comments

@doczoidberg
Copy link

doczoidberg commented Aug 16, 2016

How can I use Firebase with Angular Universal?

As stated here I have to add serviceAccountCredentials?
serviceAccount is not a member of FirebaseAppConfig?

I have a boot-server.ts and a client-server.ts. I have to use the serviceAccount for the server as far as I understand? Can you give me a code snippet?

@doczoidberg
Copy link
Author

doczoidberg commented Aug 16, 2016

I added serviceAccount property to the FirebaseAppConfig interface and added my generated json key file to the configuration. Now I get:

TypeError: _this._fbAuth.onAuthStateChanged is not a function
at Observable._subscribe (\node_modules\angularfire2\providers\firebase_sdk_auth_backend.js:45:34)

@doczoidberg
Copy link
Author

doczoidberg commented Aug 18, 2016

I tried different AuthConfig without success. Can anybody say what I am doing wrong?

I have on boot-server.ts:

...

export default function (params: any): Promise<{ html: string, globals?: any }> {
    const config: ngUniversal.AppConfig = {
        directives: [App],
        providers: [FIREBASE_PROVIDERS,
            // Initialize Firebase app  
            defaultFirebase({
                apiKey: "mykey",
                authDomain: "crackling-torch-43434.firebaseapp.com",
                serviceAccount: "firebasekey.json",
                databaseURL: "https://crackling-torch-43434.firebaseio.com",
                storageBucket: "crackling-torch-43434.appspot.com"
            }),
            firebaseAuthConfig({
                provider: AuthProviders.Google,
                method: AuthMethods.Password
            }),
            ngCore.provide(ORIGIN_URL, { useValue: params.origin }),
            ngCore.provide(REQUEST_URL, { useValue: params.url }),
            ...ngUniversal.NODE_HTTP_PROVIDERS,
            provideRouter(routes),
            ...ngUniversal.NODE_LOCATION_PROVIDERS,
        ],
        // TODO: Render just the <app> component instead of wrapping it inside an extra HTML document
        // Waiting on https://github.com/angular/universal/issues/347
        template: '<!DOCTYPE html>\n<html><head></head><body><app></app></body></html>'
    };

    return bootloader.serializeApplication(config).then(html => {
        return { html };
    });
}
Call to Node module failed with error: EXCEPTION: Error in ./App class App - inline template:3:12
ORIGINAL EXCEPTION: TypeError: _this._fbAuth.onAuthStateChanged is not a function
ORIGINAL STACKTRACE:
TypeError: _this._fbAuth.onAuthStateChanged is not a function
at Observable._subscribe (\node_modules\angularfire2\providers\firebase_sdk_auth_backend.js:45:34)

@davideast
Copy link
Member

@doczoidberg We aren't working for Angular Universal just yet, but we plan on doing so in a future release.

Track #191 for updates as it is the original issue.

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

2 participants