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

Datatbase secretes have been depreciated #221

Closed
LindaLawton opened this issue Jan 16, 2020 · 10 comments
Closed

Datatbase secretes have been depreciated #221

LindaLawton opened this issue Jan 16, 2020 · 10 comments

Comments

@LindaLawton
Copy link

Datatbase secretes have been depreciated do you have a way of doing this using Firebase Admin sdk?

image

var auth = "ABCDE"; // your app secret
var firebaseClient = new FirebaseClient(
  "<URL>",
  new FirebaseOptions
  {
    AuthTokenAsyncFactory = () => Task.FromResult(auth) 
  });

@tanwarsatya
Copy link

Yes this need to be addressed, any help will be appreciated.

@LindaLawton
Copy link
Author

I think I got this working I just need to find the code and I can update this

@tanwarsatya
Copy link

You can fork and submit a PR. How did you got it working did you modify the code ?

@LindaLawton
Copy link
Author

I used the Google api .net client library service account auth code to login to the admin API

@proyoli
Copy link

proyoli commented Mar 19, 2020

Any news regarding this matter?
@LindaLawton can you please elaborate on how you used the Google api .net client library?
Thanks.

@LindaLawton
Copy link
Author

Login using a service account with the Admin sdk api.

@wikes82
Copy link

wikes82 commented Jul 22, 2020

for anyone needing sample code to use service account file
var firebaseClient = new FirebaseClient(FirebaseUrl, new FirebaseOptions { AuthTokenAsyncFactory = () => GetAccessToken(), AsAccessToken = true });

GetAccessToken() is something like this :
private async Task<string> GetAccessToken()
{
var credential = GoogleCredential.FromFile(pathToJsonFile).CreateScoped(new string[] {
"https://www.googleapis.com/auth/firebase.database"
});

ITokenAccess c = credential as ITokenAccess;
return await c.GetAccessTokenForRequestAsync();

}

@JasperTack
Copy link

The sample code from wikes82 worked for me when I added the second scope:

// Define the required scopes.
var scopes = [
  "https://www.googleapis.com/auth/userinfo.email",
  "https://www.googleapis.com/auth/firebase.database"
];

As described here: https://firebase.google.com/docs/database/rest/auth

@monodop
Copy link

monodop commented Mar 6, 2021

Would love to see this documented on the readme

@bezysoftware
Copy link
Collaborator

bezysoftware commented Jun 21, 2021

Linked from readme, thanks

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

7 participants