Unauthorized when authenticating via Auth0 provider

I’m trying to authenticate users using Auth0, and have followed the instructions in the documentation (Fauna’s), but keep getting ‘unauthorized’ returned. I’m currently on the free plan, and have noticed the documentation states that this is a paid feature but on the pricing page is seems to say that third-party authentication is provided. Is this failing because it is not supported on the free plan, or have I done something wrong in setting this up?

The issue seems to be with accessing the collection and/or index - if I connect to the client with the secret key it works, but as soon as I perform a query it fails. I granted all access permissions on the role that I’m assigning to authenticated users, but still no joy.

Looking at other posts about the use of GraphQL (which I am not using) I managed to work out that the domain option is required:

    const client = new Client({secret: accessToken, domain: "db.eu.fauna.com"});

Actually, it is not that simple. I have two accounts - one authenticated through Netlify and one authenticated through GitHub. Both are on the free plan at the moment. The change I made to use the domain option works with the GitHub authenticated account, but not the Netlify authenticated account. Both databases are in the Europe region group, so not sure what the difference would be.

Hellooo! First just to clarify: 3rd party auth is supported for Free and Individual plans. Additionally, how you prefer to sign in to your account does not affect how keys/tokens connect to your databases – we can trust that your account login through Github/Netlify is not affecting the authorization of your users.

You are right that you can get unauthorized errors if you do not specify the correct Region Group endpoint (See the Connections page for your preferred driver). If you are certain that the domains are set appropriately, then the roles are the next thing to look at.

You can run a simple query that fetches no data to determine if your connection is properly authorized. The following should need no permissions, so if it succeeds then you can know the connection is configured properly.

client.query(q.Abs(1))

If this succeeds, but your other queries do not, then there is likely permissions missing from your Role.

It is all working now. I did have issues with the Netlify authenticated account, and I appreciate that it won’t have anything to do with the way I was authenticating. I created a new database in the account this morning and was unable to authenticate users, but it is now working. The only thing that has changed is that I authenticate my account with a un/pw now. I’ve reused the roles and permissions from earlier. It is bizarre.

One thing I did notice was that dashboard content wasn’t being updated properly, or taking a long time to update. If I refreshed the page I’d get an error page suggesting I refresh, and when I did that I had to authenticate with Netlify again. I didn’t have these issues with the GitHub authenticated account.

All good now. :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.