How do I get "storageBucket" in Firebase to generate? - javascript

Firebase keeps giving me empty "" instead of generating a URL for "storageBucket" when I try to get the code to paste into my HTML for login through Google. I am assuming this is the reason I am getting the error: This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.(anonymous function) # iframe.js:84
I am using browser sync to user localhost which is supposed to be an authorized domain. I have the firebase cdn in my header of my HTML and everything that was generated for my firebase app (except for the storageBucket). I tried importing my app to the new Firebase, just typing in my app name in a similar storage bucket URL ("eventSpot.appspot.com") and I tried just creating a new app in Firebase. None of these worked. Is there something I am missing?
Thanks in advance for your help! :)

The storage tab can take some time just after project creation - but if you've left it a little while and you're still getting the error, it may be some APIs have not been enabled.
Can you go to https://console.developers.google.com/project/_/apis/enabled
Check for:
App Engine Admin API
Google Cloud Storage
Google Cloud Storage JSON API
If any aren't enabled, enable them. After that, try the storage console again.

Related

Can a user sign in to a firebase app by logging in to another app?

I have an electron app and electron apps don't allow firebase auth by default.
Therefore, what I want is that I'll develop a web app which will be hosted on a server.
User will open the corresponding URL and will login there via firebase auth.
Now I want that user should copy something like ID token or Refresh token and should paste in the electron app and he/she should get logged in there too.
Is it possible?
If yes, then how? any example please?
As much as I researched, I found out that firebase ID tokens do expire within a short duration let's say 1 hour.
And there's no way to get the refresh token.
Please help me, I'm struggling with this since many days and my app development is obstructed due to this.
If this is not possible, then please guide me that what should I do?

Firebase Facebook authentication on localhost

I have a Vue.js app that uses Firebase for authentication and I'm trying to wire up the Facebook provider. I believe I have all my Firebase related code and configuration correct, but when I test my implementation from http://localhost:8080), I keep getting the Can't load URL: The domain of this URL isn't included in the app's domains. Facebook error.
The problem, from what I can tell, is that I need to provide a valid "callback" URL that returns the authentication response to my application. This is what Firebase tells you to do when setting up Facebook authentication, and what my research of the error confirmed, but the Valid OAuth Redirect URIs field in the Facebook App Settings page (which is where I surmised I need to put my return URL) rejects URLs containing localhost. I even tried to add the URL to any of the other fields in the Settings pages that look like they want URLs but they all respond the same. Here's a screenshot demonstrating this:
So my questions are 1) how do I configure my Facebook App to allow localhost testing, and 2) how do I fix the Can't load URL Facebook error?
Let me know if I need to include my pre-login Vue code. FWIW, I use Firebase's linkWithRedirect(); and signInWithRedirect() methods for logging in (as opposed to linkWithPopup() and signInWithPopup()).
Turns out you're supposed to paste the exact .../__/auth/handler URL that Firebase gives you into the Facebook Valid OAuth Redirect URIs field, even while still developing locally. I was under the impression that the URL should be adapted to the environment - i.e. http://localhost:8080/__/auth/handler for development and https://my-app.firebaseapp.com/__/auth/handler for production.
But nope, use the production URL even in development.

I need a way to get updated oauth tokens for google photos

I'm currently working on an application for myself in which I need access to my own photos/albums on Google Photos. I have gotten by using the oauth 2.0 token generated in the playground, but I'd like to get a more permanent solution that does not require me manually regenerating the token. Is this possible with Google Cloud? The app is meant to run in daemon, so this makes any option with consent pages unusable. The scopes I'm using are:
https://www.googleapis.com/auth/photoslibrary.sharing
https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata
https://www.googleapis.com/auth/photoslibrary.readonly
I have tried using the https://accounts.google.com/o/oauth2/token and https://accounts.google.com/o/oauth2/auth endpoints to generate one programatically, but the only minor success I had was /auth sending me to a consent screen. I've also looked at using the refresh token given by Google Oauth playground with no luck there either.
Just looking to see if there is anything that I am missing.. This is my first post on stackoverflow, so please let me know if you need any more information.
I was unable to make it an internal app as it was for personal use and not for an organization.
Solved this by first using the google api package to create my own access/refresh token for my oauth client, then calling the https://oauth2.googleapis.com/token endpoint each time to generate a valid access token. I hope this can be helpful to someone else!
According to the setup documentation, as long as your app is marked as internal, you should not need to verify the app and can use it without the consent screen.

Azure AD error when fetching access token & login

I got the error when trying to get an access key for one of our APIs.
"AADSTS65001: The user or administrator has not consented to use the application with ID '{GUID}'
First, I was trying to prompt=consent during login, thinking that I had new consents that weren't prompted during login. And I got the following error.
"AADSTS65005: The application '{GUID}' asked for permissions to access a resource that has been removed or is no longer available. Contact the app vendor."
I removed prompt=consent and started fiddling with the permissions in Azure, and now I was stuck on the same error.
I changed everything as it was, but I still get the error. However, this only happens to my user. Everyone else can still log in without problems.
So my problem is actually in two parts:
The first error when trying to get an access token for the API.
Somehow I need to prompt the user with consent, but I am using adal.js which uses a silent retrieval of the keys using an invisible iframe. I want the support to be when the user logs into the web app.
Is this possible?
My user can't log in to our web app anymore. Everyone else can. Did anyone encounter this before?
The product is a SPA Web App written in React, and we use adal.js (adal-vanilla) as a library for authentication to Azure AD.
Update
I finally got some stuff working. Not all the way, but at least it's a start.
The problem with this is that users registered on other tenants (this is a multi-tenant app) don't get consent to use the API. These users get the error. However, I registered a user on the same tenant, and everything worked as intended.
Problem two was solved by removing all the permissions, adding them one by one, and testing in between. Somehow this worked after two-three tries.
The problem is that users from other tenants don't get a consent prompt to access the API.
Somehow the issue got fixed, I'm not 100% sure how or why but here are the steps I performed to fix it if someone finds themselves in a similar situation:
Ensure that all permissions are correct (APIs are added as delegated permissions to the client)
All services (web app & apis) are multitenant
Update manifest with:
"availableToOtherTenants": true,
"knownClientApplications": [
"{client app application id}"
],
(availableToOtherTenants was false for the API even though it was marked as multitenant in the settings)
The consent might be possible to fix with prompt=admin_consent.
As for the second problem, you can add your web app as a known client application of the API. This will allow simultaneous consent when the user authenticates to the web app.
To do that, find the API app registration in Azure Portal's Azure AD blade. Then open its manifest (there is a Manifest button on the app blade). In there should be a "knownClientApplications" property. Add the client id of the web app in the array and save the manifest.
E.g.:
"knownClientApplications": [
"bda6ffff-ffff-ffff-ffff-ffff8bf8c57f"
],

Google Cloud Storage Bucket: XML error when reloading an Ember.js app in GCS

We recently moved an Ember.js app hosted in an Amazon AWS S3 bucket to a Google Cloud Storage Bucket. The app works great when we load the index.html page. Ember transitions work just fine however, when we directly visit a URL that isn't the project's main route (for example, /account-settings) or reload a URL that we are working on, we get the following error:
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
</Error>
My assumption is that this has to do with the request not being handled by the Ember Router and index.html? Is there any way to tell Google Cloud Storage to redirect all requests to index.html so that the Ember Router can handle it? I couldn't find any solutions to fix this in the Google Cloud documentation. How can I fix this?
I managed to fix this by setting the error page of my Google Cloud Storage bucket to index.html.

Categories

Resources