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

FR: support createCustomToken using default google credentials #224

Closed
manishtpatel opened this issue Mar 7, 2018 · 10 comments
Closed

FR: support createCustomToken using default google credentials #224

manishtpatel opened this issue Mar 7, 2018 · 10 comments

Comments

@manishtpatel
Copy link

Firebase functions need custom credentials to use createCustomToken() for now. Looks like a missing functionality, we need to manage different credentials for each environment just to use createCustomToken(). There is no reason to not support createCustomToken() using default google credentials.

@manishtpatel
Copy link
Author

In a second thought could be encryption of the token issue with different credentials.

@hiranya911
Copy link
Contributor

@manishtpatel This is in our roadmap. Can't provide a specific timeline yet, but please know that this is definitely something we wish to support.

@sbnon
Copy link

sbnon commented May 10, 2018

Coming from firebase/firebase-functions#3.

With Firebase Functions v1.0 no longer supporting manually setting the certificate; is there any update on this? Alternatively, can support be added back to the Admin API to allow manually setting the certificate?

Is there an alternative way to enable createCustomToken on Firebase Functions?

@raymondma1
Copy link

+1

@hiranya911
Copy link
Contributor

admin.initializeApp() still accepts the same parameters as before -- nothing has changed here. You can parse a service account file, and specify a certificate credential as shown here: https://firebase.google.com/docs/admin/setup#initialize_the_sdk

Firebase Auth and Admin SDK will make this use case easier to implement in a future release, but for now you should manually pass the certificate credential.

@raymondma1
Copy link

@hiranya911 Yup, did that instead and works fine! Thanks

@hiranya911
Copy link
Contributor

I've started making some progress towards supporting this use case (creating custom tokens without a service account). My first attempt is now undergoing testing in the https://github.com/firebase/firebase-admin-node/tree/hkj-jwt-sign branch. Stay tuned.

@piuccio
Copy link

piuccio commented Jun 29, 2018

@hiranya911 I hope your PR will be merged soon, I'm trying to upgrade firebase functions to version 1 and I use createCustomToken in my oauth functions but

admin.initializeApp();

complains because Error: createCustomToken() requires a certificate with "private_key" set.

and

admin.initializeApp({
  credential: admin.credential.cert(account),
  projectId: process.env.FIREBASE_CONFIG.projectId,
  databaseURL: process.env.FIREBASE_CONFIG.databaseURL,
  storageBucket: process.env.FIREBASE_CONFIG.storageBucket,
});

complains because Error: Can't determine Firebase Database URL.

I think I'll have to revert back

@camstuart
Copy link

+1

@hiranya911
Copy link
Contributor

This feature is now implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants