The Unofficial Replit Auth Flask Extension
Replit authentication is an amazing thing. This package provides an easy way to use it.
from flask_replit_auth import replit_auth
from flask import request, Flask
app = Flask(__name__)
replit_auth(app)
@app.route("/")
def index():
if request.user:
return request.user['username']
else:
return 'Not logged in!'
if __name__ == "__main__":
app.run(host='0.0.0.0')
Initialize replit auth on your app by calling replit_auth(app), after creating your flask app. To get information, call request.user, which will either return None or a dict with the information.
Replit Auth - Frontend
var button = document.getElementById('login_with_replit');
if (location.protocol !== 'https:') {
alert('Replit auth requires https!');
}
button.onclick = function() {
window.addEventListener('message', authComplete);
var h = 500;
var w = 350;
var left = (screen.width / 2) - ( w / 2);
var top = (screen.height / 2) - (h / 2);
var authWindow = window.open('https://replit.com/auth_with_repl_site?domain=' + location.host, '_blank', 'modal=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left)
function authComplete(e) {
if (e.data !== 'auth_complete') {
return;
}
window.removeEventListener('message', authComplete);
authWindow.close();
// Reload the page to get the credentials.
location.reload();
}
}
Usage:
- Apply the javascript code above to your website.
- Set the
idof you login button tologin_with_replit.
Metadata
Release files for flask-replit-auth 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_replit_auth-1.1.1.tar.gz | 3.2 kB | Without provenance | Details for flask_replit_auth-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_replit_auth-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for flask_replit_auth-1.1.1-py3-none-any.whl |
Total release size: 6.5 kB
Release files / flask_replit_auth-1.1.1.tar.gz
| Download URL | flask_replit_auth-1.1.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbf15dd7c984b17166c2b55c44b027907a617ed227bde400d35ab775c486986f
|
|
BLAKE2b-256 checksum How to use checksums |
030b0519c32c3fb0095c5ac850edcca8a33cd468a50e8c7284c6c4e7f59e848b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/3.10.1 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
|
Release files / flask_replit_auth-1.1.1-py3-none-any.whl
| Download URL | flask_replit_auth-1.1.1-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0160dce5d7b490e0d69755d6aed9d3af708b060b058a46b03ddccfc1959e5620
|
|
BLAKE2b-256 checksum How to use checksums |
f56c82c7272d52bf16bd99b7a50b3f16c264d40d1947dec24e0b455cacb1c133
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/3.10.1 keyring/21.8.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
|
Security for flask-replit-auth 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.