Closed Miyotch closed 1 month ago
Hi @Miyotch! I was not able to access/create an account on PianoIO to test the integration. Did you follow all the steps from the first reference you shared? Are you using the Firebase Admin SDK? O creating a token following the specifications?
I've taken a look at your project and with a lot going on, It's challenging to pinpoint the issue.
Hi @paulperez-dev,
I have identified the issue with the action flow and have resolved it. The MISSING_IDENTIFIER error is no longer occurring. However, I have some additional questions. I made some changes to the Cloud Function that generates custom tokens for Firebase based on uids, but I'm getting an error when I try to deploy it. However, there is no clear error message, so I don't know what's causing the problem. Is there anything I can do from the GCP or Firebase console to check the deployment error?
Cloud function:
const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp();
exports.generateCustomToken = functions.https.onRequest(async (req, res) => { // UIDをリクエストから取得 const uid = req.query.uid; if (!uid) { res.status(400).send('UID is required'); return; }
try { // Custom Tokenを生成 const customToken = await admin.auth().createCustomToken(uid); res.status(200).send({ token: customToken }); } catch (error) { console.log('Error creating custom token:', error); res.status(500).send('Error creating custom token'); } });
Retrieval of HTTP headers yields only the following message: "Unknown error. Please contact support@flutterflow.io."
Because the reported issue is not a but, I'm going to close this issue.
Regarding the errors you are facing, are your firebase project in the Blaze plan?
Also consider the following auto-generated suggestions:
CLI Deployment: Try deploying your Cloud Function using the Firebase CLI with the --debug
flag. This will provide more detailed output during the deployment process, which might help you identify the cause of the error. Run the following command to deploy with debug output:
firebase deploy --debug
package.json
file. Sometimes, deployment errors can occur if there are missing or incompatible dependencies.By following these steps and examining the logs and deployment output, you should be able to identify the cause of the deployment error and take appropriate action to fix it.
Has your issue been reported?
Current Behavior
I have successfully integrated Piano ID, a third-party authentication provider, with FlutterFlow's Custom Authentication feature. However, when attempting to utilize Firebase as the backend database, I encountered an issue where CRUD operations fail unless the permission is set to "everyone." To address this limitation, I am considering switching to an authentication method based on Firebase's Custom Tokens.
I have configured a Cloud Function to convert these access tokens into custom tokens for Firebase authentication. However, deployment attempts result in an "Unknown Error." Despite retrieving the HTTP header, the response lacks detailed error information.
Expected Behavior
A user logs into a website that uses Piano for authentication. The Piano system generates an access token for the user. The user's browser then sends the access token to a Cloud Function. The Cloud Function exchanges the Piano access token for a Firebase custom token and returns the custom token to the browser. The browser then uses the custom token to authenticate with Firebase Authentication. The user is now granted access to the Firebase resources.
Steps to Reproduce
A third-party access token is converted to a Firebase custom token in the following Cloud Function.
ex) const admin = require('firebase-admin'); const functions = require('firebase-functions');
firebase.initializeApp();
exports.createCustomToken = functions.https.onCall((data, context) => { const uid = data.uid;
return admin.auth().createCustomToken(uid) .then(customToken => { return { customToken }; }) .catch(error => { console.error('Error creating custom token:', error); return { error }; }); });![image](https://github.com/FlutterFlow/flutterflow-issues/assets/171346424/80c96f3f-092e-44e7-9fd2-c603ac4bcc95)
Reproducible from Blank
Bug Report Code (Required)
IT8shfLlvJRgocdG0b6Ja8ZV9SAUQl87aucVku1+a0kbJuv2PZYHe+PCbVVuZ7C7a1w3CmeWmjsypq3Zv/PyGu1cNUyCbKlq3btcWwvMfHmtMsnXC6qrdWpfM5lRI0PEy8GZpAx9FNp2S1Fh3FyTf+ivVgnXQpP6IkdERPH/NrjNj0qhLDLNMCdW0iZecCfn
Context
I kindly request your assistance in troubleshooting the Cloud Function deployment issue and exploring the feasibility of implementing a Piano-like authentication system using Cloud Functions and Firebase.
Visual documentation
google_screen_recording_2024-05-31T12-47_12.077Z.webm
HTTP header![image](https://github.com/FlutterFlow/flutterflow-issues/assets/171346424/f1089d38-334a-46e1-be7d-ac57515aa83c)
Additional Info
Ref: JWT Token https://docs.flutterflow.io/data-and-backend/firebase/authentication/jwt-token
Custom token https://firebase.google.com/docs/auth/admin/create-custom-tokens?hl=ja
Piano ID https://piano.io/ja/product/id/
Environment
General
Relative to the time the changes were made, data was lost within
When following my steps to reproduce, data loss happens