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

Authorization issue with polymer-cli build + firebase deploy #2169

Closed
mshockwave opened this issue Jun 25, 2016 · 12 comments
Closed

Authorization issue with polymer-cli build + firebase deploy #2169

mshockwave opened this issue Jun 25, 2016 · 12 comments

Comments

@mshockwave
Copy link

Description

After using polymer-cli to build project(which is also generated by the tool) and deploy to firebase, if a user want to use google login, the authorization page would redirect to index.html of the app rather than normal google login page.
This issue had been filed in polymerfire repo: issue46@polymerfire

More precisely, the login page would redirect to https://<your-firebase-app-id>.firebaseapp.com/_/auth. But there seems to be a redirecting or rewriting rule which cause that URL redirect to index.html instead of google login window. @mgibas in the polymerfire's issue thread also mentioned that the problem was gone after switching to gulp to build.

Versions & Environment

  • Polymer CLI: 0.11.1
  • Operating System: Mac OS X 10.11.5

Steps to Reproduce

  1. Create an app that require user to login with google
  2. Build the app by polymer-cli
  3. Deploy to Firebase
  4. When users first login(with google), the window prompt up is index.html

Expected Results

Step 4 in the above should prompt up google login window

Actual Results

@multimikael
Copy link

Can you post your firebase.json? It should be in your projects root directory.

@mshockwave
Copy link
Author

@mikael2933
Sure:

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "build/bundled",
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

I use all of the services(realtime database, storage and hosting).
I didn't modify firebase.json since polymer init

@locomuco
Copy link

locomuco commented Jul 4, 2016

I experience the same issue...

using app-drawer-template with firebase + polymer cli

@multimikael
Copy link

To me, it doesn't seems like a problem with Google login, more like a problem between polymer routes and firebase routes. Firebase rewrites shouldn't change the URL it self. @locomuco exactly what do you experience, is it the same with the URL changing to "/index.html"?

@locomuco
Copy link

locomuco commented Jul 5, 2016

@mikael2933 doesn't work without or with rewrite rules.
Does this answer your question?

@multimikael
Copy link

What doesn't work? Is it the same problem with the URL changing to "/index.html" instead of loading the proper content?

@locomuco
Copy link

locomuco commented Jul 5, 2016

It's the same behaviour without and with applied rewrite rules

@midesweb
Copy link

midesweb commented Jul 8, 2016

The problem is with the Service Worker's cache.
The configuration of the service Worker, generated by the Polymer CLI build process, is in the file "sw-precache-config.js"

In that file you will find:

navigateFallback: '/index.html'

this configuration is explained in the GoogleChrome/sw-precache repository https://github.com/GoogleChrome/sw-precache

Sets an HTML document to use as a fallback for URLs not found in the cache.

The solution is to configure "navigateFallbackWhitelist" (Works to limit the effect of navigateFallback)

navigateFallbackWhitelist: [ /^\/home\//, /^\/other\// ]

@locomuco
Copy link

locomuco commented Jul 8, 2016

deployed and verified, since this is not a polymer-cli problem either, I'd vote to close this issue here

@motss
Copy link

motss commented Jul 21, 2016

This is my config. Feel like submitting a PR to fix this issue. Is there any situation where this path /__/ is necessary?

module.exports = {
  staticFileGlobs: [
    '/index.html',
    '/manifest.json',
    '/bower_components/webcomponentsjs/webcomponents-lite.min.js'
  ],
  navigateFallback: '/index.html',
  navigateFallbackWhitelist: [ /^\/[^\_]+\/?/ ]
};

@FredKSchott
Copy link
Contributor

Thanks for your help @midesweb @locomuco! Sounds like this can be closed, if anyone is still having trouble building please open a new issue.

broken referenced this issue in broken/nom-noms-ninja Sep 19, 2016
Error: Uncaught TypeError: Cannot read property 'instanceCount' of undefined
See: https://github.com/Polymer/polymer-cli/issues/290
@bennypowers
Copy link

Should this be in the docs? The error messages which result from this problem are vague.

@aomarks aomarks transferred this issue from Polymer/polymer-cli Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants