You can refer to my images for details. This is the code I'm running on colab:
from google.colab import drive
drive.mount('/content/drive')
cd /content/drive/MyDrive/mini
!curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee
/etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com
buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt
install ngrok
!ngrok authtoken "I added my auth token here"
from pyngrok import ngrok
from flask_ngrok import run_with_ngrok
from flask import Flask, render_template
app = Flask(__name__)
run_with_ngrok(app)
@app.route('/')
def text():
return f"Running Flask on Google Colab"
app.run()
Getting this output:
* Serving Flask app "__main__" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Running on http://de4b-35-230-126-117.ngrok.io
* Traffic stats available on http://127.0.0.1:4040
127.0.0.1 - - [17/Apr/2022 09:03:31] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [17/Apr/2022 09:03:32] "GET /favicon.ico HTTP/1.1" 404 -
When I click on the ngrok link i.e http://de4b-35-230-126-117.ngrok.io this one it gives me this.
ERR_NGROK_6022
Before you can serve HTML content, you must sign up for a free ngrok account and install your
authtoken.
So can anyone tell me what I'm doing wrong? Cuz I installed ngrok also and install auth token also in colab but still getting this error.
I was having the same issue, ngrok updated to v3 and you can either use pyngrok or update your code
Solution 1: Remove the curl commands, and add this instead: !pip install pyngrok==4.1.1
Solution 2: Update your methods to bind authtoken by following the new documentation https://ngrok.com/docs/guides/upgrade-v2-v3