The custom token corresponds to a different audience - firebase

I'm using firebase for authentication on my app, while developing I created a firebase project which I was using for that purpose, but now I've to sync it with another app. So on updating my google-services.json I'm getting the below error and am not able to connect to firebase.
The custom token corresponds to a different audience. [App ID does not match requested prject.]
How can I migrate my project to another one??

Try clearing the app data, it may be loading something from storage which is related to the other project.

I finally got the app working, basically firebase does not allow two projects with similar configuration. So in my case the test project I created while development had SHA key of my app configured, becasue of which I was getting the error.
I deleted that key and the conflict got resolved.
This is mainly in cases when you're using modules like Authentication where SHA key is used to identify the app.

Related

Problem deploying project on Firebase with Stripe

I'm trying to deploy my app that has the stripe payment extension installed. Everything works fine on the emulator (I am not using stripe for the moment) but when I try to deploy everything looks ok except deploy fails with this message:
Error: firestore-stripe-payments: Found
'projects/1234/secrets/ext-firestore-stripe-payments-STRIPE_API_KEY/versions/1'
for secret param STRIPE_API_KEY, but this instance was previously
using a different secret
projects/1234/secrets/firestore-stripe-payments-STRIPE_API_KEY.
Changing secrets is not supported. If you want to change the value of
this secret, use a new version of
projects/1234/secrets/firestore-stripe-payments-STRIPE_API_KEY.You
can create a new version at
https://console.cloud.google.com/security/secret-manager?project=1234
So I go to the link without knowing how my emulator API key works compared to the production one ( I didn't activated the Stripe account ). Here I find two keys, one is firestore-stripe-payments-STRIPE_API_KEY and the other one is ext-firestore-stripe-payments-STRIPE_API_KEY. When I click to make a new version it asks for a file with a secret.
So my main problem is: do I need to change version of both two secrets or only one? Second problem is where do I find those keys and does the test API key work on deployment?
Am I missing something here, am I on the right path?

403 when using firebase API to create a project (As an owner user, not a service account)

I am trying to create a firebase project using the api. The document for this is here: https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/addFirebase
I have created a GCP project already and I am the owner of this project. I can see my project in a request to:
https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/availableProjects/list . It has a project id of: projects/my-project-id-here
I am making the requests as a owner of the GCP project user account (I am not using a service account!) using Google OAuth 2.0 with the correct scopes (You can try it in the documentation), but I am receiving a response of:
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
I can create firebase project fine If I go to firebase website directly and create the project there.
Google take 30 days to delete my test projects, so I am restricted to how many times I can try to get this right from scratch. Therefore I am also interested to know how you fully unlink firebase from a GCP project without deleting that project. Removing the service account and disabling the APIs from GCP console doesn't seem to do the trick.
Finally, I do not know if it is relevant but I also have the same user account setup with a developer account on google play and the GCP project is linked up for API access it's created service account granted access. I don't think this is relevant though, as my understanding is that I can setup a firebase project without this.
Hope someone can help!
I've found the solution to this. You cannot use the firebase API to create a firebase project unless you've first accepted the terms and conditions which aren't shown to you until you're in a firebase project (go figure).
Anyway here are some clear steps:
Create a firebase project through the website
Open the firebase project
Accept the terms and conditions for firebase use
Delete the firebase project and enjoy the API now working.
Regarding your interest in removing firebase from a project, this is not supported. The best course of action is to undo the changes that were made when firebase was added, namely disabling the firebase APIs, removing oauth client/brand, removing API keys etc, which you have already done, and it’s the closest thing to deleting the project.

Change Firebase Cloud Message account

I have my android app running firebase cloud message using uat#gmail.com. and now, i need to change the administration to production account bbb#mycompany.com
what i have done, using bbb#mycompany.com to create new project and generate a new google-services.json and replace existing google-services.json i created with aaa#gmail.com
using android studio connect to firebase and show
Firebase: A config file "D:\xxx\xxx\google-services.json" was found, but it indicates a project ID "xxx-1vv" that you dont appear to have access to. Request access or delete the file in order to proceed with the connection process.
anyone could help??
You can transfer ownership of a Cloud (Firebase) product without having to change the way your users user the project. Please read this for details. Note that all Firebase projects are also Cloud projects, so anything you do in the Cloud console applies to Firebase.

Firebase init error: Unable to authorize access to project [PROJECT ID]

I'm trying to initialize firebase functions for an iPhone app.
I have two separate accounts that I have different firebase projects on.
I ran firebase init, but I get an error
Error: Unable to authorize access to project[PROJECT ID]
where the project ID is a project id for a project in the account im not using.
I used
Firebase use --add
and it worked perfectly.
I ran
Firebase list
and the project I want to init is listed there. But when I ran the init again I got the same error with the wrong project ID still.
ps. the other project ID doesn't come up in Firebase list
EDIT: I logged out of the different account and am logged into the correct account.
You should check the alias. Aren't you just setting your project for staging?
After Firebase use --add, you should do like
What alias do you want to use for this project? (e.g. staging) default
and also
What alias do you want to use for this project? (e.g. staging) dev
In other words, you have to switch all the alias to the project you re trying to use.
This worked for me!
Firebase login to the account that has the project.
If you're switching between two Google accounts, you have to firebase logout from one and firebase login to the other before you can access the projects in those different accounts.

Where can i find the link to my newly created app in firebase?

Im trying to locate the link that is supposed to be created along with my app on Firebase(according to the udacity Firebase course).
I found many links but none of them were accepted by the "after lesson quiz" on udacity.
The content that they have is according to the old UI of Firebase so i cant follow it step by step.
Unfortunately that course is for Firebase 2.x (www.firebase.com) and is out of date. In the legacy Firebase docs, under step 5 : Read & Write to your Firebase Database, you can see that creating a Firebase reference required the actual web address for you app. This is no longer true.
The new and correct way to setup your Firebase app does not require you to use this web address. The steps for setting up a Firebase app now are HERE.

Resources