Git Product home page Git Product logo

raimtesty's Introduction

Python Flask ReplAuth

ReplAuth is one of the most useful things if you're doing a big project w/ replit! Replit has two ReplAuths.

Using the Auth is the most easiest thing in the world. First we have our main.py file. First we create a new Flask app :

Import Flask and create new Flask app
from flask import Flask, render_template, request
app = Flask('app')
@app.route('/')

And then we request the headers :

Requested Headers :
def hello_world():
    print(request.headers)
    return render_template(
        'index.html',
        user_id=request.headers['X-Replit-User-Id'],
        user_name=request.headers['X-Replit-User-Name'],
        user_roles=request.headers['X-Replit-User-Roles'],
      user_bio=request.headers['X-Replit-User-Bio'],
      user_profile_image=request.headers['X-Replit-User-Profile-Image'],
      user_teams=request.headers['X-Replit-User-Teams'],
      user_url=request.headers['X-Replit-User-Url']
    )

In this code we've requested all the possible headers, which are these :

All Replit Headers
X-Replit-User-Bio
X-Replit-User-Id
X-Replit-User-Name
X-Replit-User-Profile-Image
X-Replit-User-Roles
X-Replit-User-Teams
X-Replit-User-Url
Once we've requested all these headers, we can show the information we've got after the user has passed through the Auth. This info will be displayed on the console, but can also be displayed in a html file.

We can show this by displaying the variable assined to a header in a html tag. It can also be showed with out a tag. If we wanted to show the username of the user we would put this :

<h1>{{ user_name }}</h1>

And the answer the output will be a heading (h1) with the username.

ReplAuth FAQ

The question is in a quote and in italic and the answer is in a bullet point.

ReplAuth FAQ

How many ReplAuths are there?

  • There are 2 repl auths!

Which ReplAuths are there?

  • Node.js and Python Flask

Is there a Replit Documentation on ReplAuths?

Template

Name : Python Flask ReplAuth

Description : The Python Flask ReplAuth is easy and useful to use! What are you waiting for? Start using the ReplAuth today!

Errors/Feedback/Questions

If you found any error, want to give feedback or have any question feel free to do any of these things :

  • Comment on the template repl
  • DM me on Discord (Hugoonreplit#7284)
  • Mail me at [email protected]

If you would like other options to get help you could try some of these :

All errors/feedback/Questions is appreciated!

raimtesty's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.