Giter Site home page Giter Site logo

devaneatshit / recnet-login Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jegarde/recnet-login

0.0 0.0 0.0 49 KB

A Python package, that allows you to acquire your RecNet authorization bearer token with your account credentials!

License: MIT License

Python 100.00%

recnet-login's Introduction

RecNet-Login

This is a Python package, that allows you to acquire your RecNet bearer token and more with your account credentials!

Installation

Done via git:

python -m pip install git+https://github.com/Jegarde/RecNet-Login.git#egg=recnetlogin

Getting started

The absolute basics. This is basically all you need to know to get started.

from recnetlogin import login_to_recnet

username = ""
password = ""
login = login_to_recnet(username, password)  # Login with account credentials

print(login.access_token)  # Print out the bearer token

Usage

Logging in to RecNet is very simple with this package.

Begin by importing the package:

from recnetlogin import login_to_recnet

Now let's try logging in:

login = login_to_recnet("Coach", "recnet87")  # Let's pretend these are valid credentials

We now have a login_to_recnet object called login. All this information can be gotten from the object:

print("Success:", login.success)  # If login was successful (It should raise an exception if unsuccessful, though)
print()
print("Access token:", login.access_token)  # Access token / Bearer token
print("Access token expiration:", login.access_expiration)  # Its expiration Unix timestamp
print("Access token decoded:", login.access_decoded)  # Decoded
print()
print("Id token:", login.id_token)  # Id token
print("Id token expiration:", login.id_expiration)  # Its expiration Unix timestamp
print("Id token decoded:", login.id_decoded)  # Decoded
print()
print("Data:", login.data)  # Account data from /account/me

If the login was unsuccessful, it will raise InvalidCredentials.

try:
    login = login_to_recnet("Coach", "recnet87")
    print("Success!")  # Successfully logged in without errors!
except recnetlogin.login.InvalidCredentials:
    print("Unsuccess!")  # Incorrect account credentials.

Attributes

If the login was successful, the following attributes will be available:

  • success | If login was successful

  • access_token | Your bearer authorization token

  • access_expiration | Bearer token's expiration Unix timestamp

  • access_decoded | Decoded bearer token

  • id_token | Your id token

  • id_expiration | Id token's expiration Unix timestamp

  • id_decoded | Decoded id token

  • data | Your data from /account/me

Arguments

You can also directly run the login.py file. You can also run it with username and password arguments. Make sure to run it from the terminal to prevent it from shutting down on finish.

python login.py USERNAME PASSWORD

If successful, it will print all possible data.

Alternative ways of getting your bearer token

  • Run this JS script on your browser's DevTools console.
url = window.location.href
if (url.includes("rec.net")) {
   try {
    b_token = "Bearer " + JSON.parse(localStorage.getItem("oidc.user:https://auth.rec.net:recnet"))["access_token"]
    console.log(b_token)
    alert("Successfully printed bearer token on console!")
    }
    catch(err) {
        alert("Not logged in on RecNet!")
    } 
}
else {
    alert("Not in rec.net")
}
  • Generate from cookie

Rec Room API Tool Box made by zigzatuzoo

recnet-login'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.