Search code examples
firebase-authenticationfirebaseui

How can I add Google scopes later?


I have an Angular 4 app that uses Firebase UI (web) with Google auth. For our company staff users, I need to ask for more permission scopes than non-staff users. I don't necessarily need those extra scopes right away, though.

I'm thinking that the login screen will have a "staff login" checkbox that toggles the config. However, the new firebaseui.auth.AuthUI(firebase.auth()) call has already been made.

  • Is it bad if I call ui.start() a second time with a different config?
  • Or: is there something I should make sure I do to cleanly dispose of the prior AuthUI before creating a new one?
  • Or: (ideally) is there a way to simply force a prompt later for additional scopes, only when needed?

Solution

  • You can re-render the widget with: ui.reset(); ui.start('#firebaseui-container', myNewConfig);