firebase hosting - terminal hangs waiting for authentication - terminal

I just created a firebase account using my Gmail account and I want to test deploying a simple JS app to the cloud. I'm using Linux. I type in firebase init and the terminal says, "Waiting for authentication" then the browser opens and for a quick second I see a message "Authenticate Application" but then it disappears and asks me to login to my Google account. I login and it redirects me to my dashboard. In the terminal window it is still waiting for authentication. So the browser never tells the terminal window that I logged in and is stuck.
Any ideas?

I found a different thread with an answer that worked for me (How to login to `firebase-tools` on headless remote server?)
On the terminal use the following command:
$ firebase login --no-localhost
A different authentication link will be generated. On any machine, open a browser and paste the link from the terminal.
The result is an authorization code that you now need to paste into the terminal.
Everything should work well...I hope...

before firebase init you should be logged in (firebase login)
if you hit firebase login
first your cli asks permission to allow firebase
Allow Firebase to collect anonymous CLI usage information?
type yes and hit return
now an url will be generated
copy the url and open in any browser
login (if required)
if you are using first it asks for permission when you hit ok
login successful

Related

when i am trying to login Heroku there is an message IP Address Mismatch [duplicate]

Previously I could sign into the heroku command line interface with heroku login. But now I get an IP address mismatch error. How should I resolve this?
Copy and paste heroku login -i in your terminal. This is what solved it for me.
Just adding some detailed steps to resolve the issue
Navigate to https://dashboard.heroku.com/account/applications
In Authorizations click on create authorization button
Add description in pop up eg.heroku cli and leave expire after blank if you dont want it to expire
You will get authorization token
in cli run heroku login -i
when it prompts for password enter the authoriation token
The accepted answer (run heroku login -i) doesn't work for accounts with MFA enabled. What I did instead was to reveal my account's API key and put it into ~/.netrc like so:
machine api.heroku.com
login <MY_EMAIL>
password <API_KEY>
machine git.heroku.com
login <MY_EMAIL>
password <API_KEY>
And voila! I can now use the CLI. This worked for me with Google CloudShell.
P.S. -- I added my machine's SSH key but could not understand how to use that to configure the CLI's access. It seems hard-coded to look for API keys in ~/.netrc.
If you are using Multi-Factor Authentication you could generate an Authorization token in settings page: https://dashboard.heroku.com/account/applications
Run heroku login -i and use the generated token as password.
If you're using a Mac running macOS 12 Monterey with the Private Relay feature enabled, you'll need to turn that off while you complete the Heroku CLI authentication workflow, since that feature is obfuscating your actual IP address by proxying your traffic through a pool of IP addresses.
For accounts that have MFA.
Run heroku login, press any key to open up browser window. Copy the url and open it in incognito mode.
This error will occur when your machine is behind a proxy if you disable the proxy temporarily then authentication will be done.
New changes where added by Heroku on login. You can find the change logs here.
In case if you are behind the firewall you may need to set the proxy.
set HTTP_PROXY=http://proxy.server.com:portnumber
If you are a Mac user on 12.3 or later, you need to open System Preferences, > Network > Wi-Fi, and then uncheck "Limit IP Address Tracking" for the duration of your authentication.
New OSX masks your IP address, and Heroku login doesn't know how to deal with it. All you need is to let Heroku verify IP before/after auth, and you'll be good to go.
for me heroku login -i worked..
didnt need the token.after heroku login -i it wanted my credentials...i.e email and password and i was logged in
If you're using Multi Factor Authentication you have to create an API key. To do that:
Go here: https://dashboard.heroku.com/account (login if asked)
Click here:
Open the hidden file located at ~/.netrc and paste your API key in the two 'password' fields.
For example, if your API key is 'a8g73nga-9vb2-0184-afbc-54fac2b66c75', then it should look like this:
machine api.heroku.com
login your.email#example.com
password a8g73nga-9vb2-0184-afbc-54fac2b66c75
machine git.heroku.com
login your.email#example.com
password a8g73nga-9vb2-0184-afbc-54fac2b66c75
The heroku CLI will now work!
Reference
Heroku CLI Authentication docs
This worked for me:
1/ Logout in the browser
2/ Clear cache and cookies for heroku.com (optional)
3/ Run "heroku login"
4/ Logging in the browser tab opened by the CLI
I initially installed Heroku with Snap software package manager.
Installing it with npm solved my problem.
copy and paste the code below.
npm i -g heroku
Close or switch terminal, and then rerun the command "heroku login" This works for me!
My default browser is Safari with private relay on. This was my issue. I just copied the url from the Safari browser to one of my other browsers (Brave) and it worked.
I was able to connect with the following:
heroku login -I //
email: user#email.com //
password: api key # from account settings
So satisfying!
For some reason heroku login -i led to some I/O issues on Google Colab for me.
I needed to press the return key multiple times after entering the password, and that somehow made the credentials incorrect.
I had to open up a Colab Terminal to login as I would via any Linux-based shell (The Colab terminal is available on Colab Pro and Pro+).
I had the same issue. I used heroku login. It worked.
I tried all the Solutions mentioned above but the VPN solved my issue.
I think i have a problem with my ISP or HTTP PROXY
HTTP_PROXY=http://proxy.server.com:portnumber

Heroku Login Multi-Factor Authentication mfa_required error (without opening a browser)

When using Heroku Multi-Factor Authentication, is there any way to login via the console without opening the browser?
ubuntu:~/environment $ heroku login -i
heroku: Enter your login credentials
Email [hello#gmail.com]:
Password: ****************
› Error: Your account has MFA enabled; API requests using basic authentication with email and password are not supported. Please
› generate an authorization token for API access.
›
› Error ID: mfa_required
Yes. Basically, to set this up what you want to do is:
Login to Heroku and create an API Token under "Account settings". (You said "without opening a browser", and I'm assuming you mean 'How to authenticate from the command-line'. To set this up you will need to open a browser ... once ;)
In your local machine's home directory, check to see if you already have a file called .netrc. If not, simply create one like so -- touch ~/.netrc.
From there you'll want to append the following to that file (and save):
machine api.heroku.com
login <your-email-goes-here>
password <the-api-token-goes-here>
machine git.heroku.com
login <your-email-goes-here>
password <the-api-token-goes-here>
If you just created the .netrc file you'll want to chmod 600 .netrc to give it necessary permissions.
At this point, you can try the command heroku auth:whoami and hopefully see your user e-mail printed back to you.
FWIW, Heroku does have some docs covering this here, but to be honest, the docs are rather disjointed and I would think unhelpful to someone that's never done something like this before, which is why I tried to go step-by-step.
I hope this is what you wanted and / or someone finds this helpful :)
For multi-factor authentication enabled heroku account, If you can get the API key then there is a simpler way to sign in via CLI. type -> heroku login -i
enter the email id associated with your heroku account and for password you must enter the API key that you got from the account settings page.

Unable to login to Heroku

I am trying to login to my Heroku account but when I click the login button I get the following message :
To keep your account secure, we verify your identity.
Click Verify, then use your built-in authenticator.
Built-In Authenticators
Built-In Authenticator #1 Account
XYZ
To use built-in authenticators, set up Windows Hello.
Here is the snapshot
download google authentication app from play store, it will give you code enter that and you can log in easily

How to Create OAuth Client ID?

I am trying to run this github project.
For this I need to create credentials and OAuth Client Id.
When I click to create. After selecting web applications and typing the name I see authorised javascript and authorised redirect uri.
So what should I enter there because I tried with keeping both fields empty. But I got error saying no redirect url found for client id
Please help me.
I am using Developer Console for first time can't find any help on internet. This site is my last hope.
I did as said in [comment].2
Here is what I got in Linux shell and the error i received on redirected url opened webpage.
Linux Shell Message
/YouTube-Subscription-Importer/env/lib/python3.6/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access subscribe.py-oauth2.json: No such file or directory
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?client_id=1069660256195-n8adm0dmi70v29i55hcfblftle09hb5n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&access_type=offline&response_type=code
If your browser is on a different machine then exit and re-run this
application with the command-line parameter
--noauth_local_webserver
Snipe of what redirect url webpage said
**MOST IMPORTANT
I am running this in windows bash.
Now tell me what to do next.
I just simply need a tutorial/how-to use guide for Google developer console credentials and OAuth Screen.
**
You need the redirect URL, you will be redirected from Google OAuth Consent Screen to https://REDIRECT_URL?code=AuthorizationCode, you can just set it to http://localhost.
After creation, you can your find Client ID on the Credentials page.

How to get different connection for different browser session/machine so I can get different profile feeds?

I followed tutorial on:
https://spring.io/guides/gs/accessing-facebook/
I run the application and successfully authenticate with a single user. Home page returns my feeds.
Now I connect to the application from another browser/machine and go to home page - I see feeds of first browser session/machine.
I am expecting to be asked to log in again when connecting from different browser/machine.
What am I missing?
Didnt try it, and depends on exact configuration :
When you logged in on the first browser you gave facebook the permission to allow your application to access your facebook account.
If you are logged in to facebook before on the other browsers with the same user, the permission given to the app through interaction on the first browser might be sufficient.
You can try to use incognito mode on a browser, in this case you should definitely have to authorize again.

Resources