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

Getting Unauthorized error #2

Open
datawebbie opened this issue Jul 13, 2020 · 1 comment
Open

Getting Unauthorized error #2

datawebbie opened this issue Jul 13, 2020 · 1 comment

Comments

@datawebbie
Copy link

ERROR

[Unauthorized: unauthorized] {
description: 'Unauthorized',
requestResult: RequestResult {
method: 'POST',
path: '',
query: null,
requestRaw: '{"let":[{"result":{"match":{"index":"allSignatures"},"terms":[]}}],"in":{"map":{"lambda":"ref","expr":{"get":{"var":"ref"}}},"collection":{"select":"data","from":{"paginate":{"var":"result"},"size":101}}}}',
requestContent: Expr { raw: [Object] },
responseRaw: '{"errors":[{"code":"unauthorized","description":"Unauthorized"}]}',
responseContent: { errors: [Array] },
statusCode: 401,
responseHeaders: {
connection: 'keep-alive',
'content-length': '65',
'content-type': 'application/json;charset=utf-8',
date: 'Mon, 13 Jul 2020 10:44:01 GMT',
'www-authenticate': 'Basic realm="Unauthorized"',
'x-faunadb-build': '20.07.00.rc2-bdcd631',
'x-txn-time': '1594637040944308'
},
startTime: 1594637040116,
endTime: 1594637041301
}
}

Even with correct Admin key, I'm getting this error when running gatsby develop. FaunaDb documentation says:
"You would see the following error:
{
"errors": [ { "code": "unauthorized", "description": "Unauthorized" } ]
}
If your application is using one of the native Drivers, you should create a new client instance using the user’s token as the secret. Some drivers can create session clients in which the underlying HTTP connection is shared, so that you can intermingle queries using different tokens easily."

How do I create a new client instance using user's token?

@patrickspafford
Copy link

@datawebbie
See my PR and let me know if this helps you out.

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