-
Notifications
You must be signed in to change notification settings - Fork 362
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
[Firestore] Manual auth #2349
Comments
You need to do this in two stages:
It's not as simple to create a
If you don't need to shut the channel down (which you usually don't) you can then forget the channel in your code. Otherwise, you'll need to keep a reference to it for shutdown - you can't obtain the channel from the It's likely that creating a Please add a comment to this issue when you've tried these steps, so I can close it or help you further. |
Thanks Jon, i managed to get it working with your instructions, this is the code i ended up with: using Google.Cloud.Firestore;
using Google.Apis.Auth.OAuth2;
using Google.Cloud.Firestore.V1Beta1;
using Grpc.Core;
using Grpc.Auth;
...
GoogleCredential credential = GoogleCredential
.FromFile("auth.json");
ChannelCredentials channelCredentials = credential.ToChannelCredentials();
Channel channel = new Channel(FirestoreClient.DefaultEndpoint.ToString(), channelCredentials);
FirestoreClient firestoreClient = FirestoreClient.Create(channel);
FirestoreDb firestoreDb = FirestoreDb.Create("doc-location", client: firestoreClient); |
Great - will close the issue. So glad it worked :) |
Hello, any guidance in my issue? I've been searching feverishly for a resolution and haven't come across one yet. **Problem ** |
@joshuabooker: Xamarin isn't a supported platform, I'm afraid. Our libraries depend on the gRPC library, which contains a native library. While it's technically feasible for that to be cross-compiled for all the relevant platforms, and packaged up appropriately, we have higher priority work items at the moment. We'd like to support a broader range of platforms, but I don't expect that to happen any time soon. |
@joshuabooker This isn't produced or supported by us, but might this package allow you to use firestore on xamarin? https://www.nuget.org/packages/Xamarin.Firebase.Firestore/ |
you´re the man!... Thanks so much bro! |
Hello, the solution was supurb & worked several day. But now I am getting following error. I didn't make any changed but don't know what is happening. I am using this in a wpf application.
|
@bluetoothfx: Please raise a new issue with more context and sample code. (Although I'm on vacation this week, so replies may take a bit longer.) |
@jskeet Sorry for my late response. I was taking time because before I post I was making sure on my end if anything I am missing. And I found that I was switching between Ubuntu and Windows and I don't know why my Windows System date time was not correct. And when that was incorrect I was getting |
@bluetoothfx: Excellent, glad to hear it's okay. |
How to do this in |
@DenisNP: It's much easier now - just use |
As of 2021, the above link does not seem to work.
|
@mohumohu-corp: Sorry for that link no longer working... but there are now details here: https://cloud.google.com/dotnet/docs/reference/help/getting-started In this case, the simpler code would be: var firestoreDbBuilder = new FirestoreDbBuilder
{
ProjectId = "your firebase project id",
CredentialsPath = "path to your credential json file."
}.Build(); |
Hello, how can i provide the service account thru code? FirestoreDb.Create does not have an overload for the path to the key file
The text was updated successfully, but these errors were encountered: