rowyio / rowy

Low-code backend platform. Manage database on spreadsheet-like UI and build cloud functions workflows in JS/TS, all in your browser.
http://rowy.io
Other
5.83k stars 478 forks source link

Adding anonymous signin option using firebase #666

Open aryan1107 opened 2 years ago

aryan1107 commented 2 years ago

Hi I am facing issues for adding anonymous sign up option of Firebase in this. Any idea how it can be added?

notsidney commented 2 years ago

Hi there, to add Anonymous sign-in, go to Project settings and enable it in the Sign-in options dropdown.

image

Then in the Firebase Console, go to Authentication > Sign-in method and enable the Anonymous provider.

It looks like there’s a bug that causes the app to crash for anonymous users, so we’ll have to fix it on our end.

image
shamsmosowi commented 2 years ago

the error is occurring because rowy expects authenticated users to have atleast 1 role, We'll need to look into providing a general solution. in the meantime, you can add to an auth event triggered cloud function that assigns a newly created a single role, you can use the role to restrict which tables anonymous users have access to Example:

export const autoRoles = functions.auth.user().onCreate(async (user) => {
  try {
    await auth.setCustomUserClaims(user.uid, {
      roles: ["BASIC"],
    });
  } catch (error) {
    console.log(error);
  }
});