Skip to content

DonutByte/pylgate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pylgate

latest release Supported Python versions GPLv3 License

PalGate automation using Python.

Table of contents

Disclaimer

This project is intended for research purpose only.

This project is not affiliated with, endorsed by, or in any way officially connected to PalGate.

The use of this software is at the user's own risk. The author(s) of this project take no responsibility and disclaim any liability for any damage, loss, or consequence resulting directly or indirectly from the use or application of this software.

Users are solely responsible for ensuring their use of this project complies with all applicable laws, regulations, and terms of service of any related platforms or services. The author(s) bear no accountability for any actions taken by users of this software.

Introduction

This project provides a simple way to generate PalGate's derived token, without using third-party libraries!

Attention!

This project is based on reverse engineering the PalGate App. While every effort has been made to ensure accuracy, please be aware of the following:

  1. Some information may be incomplete or incorrect.
  2. The project may not fully represent the original functionality.
  3. Updates or changes to the original app may render parts of this project obsolete or inaccurate.

If you encounter bugs, inaccuracies, or have improvements please open an issue or submit a PR

Terminology

Below are some essential terms specific to the project's context.

session token
Token provided by PalGate's API after successful login
token type
Type of session token can either be SMS, PRIMARY or SECONDARY
phone number

Phone number associated with your PalGate account in international format without the + (plus sign) prefix - i.e just digits

PalGate refers to it as user id

derived token
Time sensitive token generated by all of the information above which is used by PalGate's API as your API key

The whole purpose of this project it to generate this token which is done by calling pylgate.generate_token

PalGate refers to it as token (not to confuse with session token)

Getting Started

Installation

Install the package using pip:

pip install git+https://github.com/DonutByte/pylgate.git@main

Generate a Session Token

Download and run this script which acquires a session token using the Device Linking feature.

Make sure to install its requirements first:

pip install qrcode requests

The script prints a QR code to the screen which you have to scan using the PalGate app on your phone:

  1. Launch the PalGate app on your phone
  2. Press the (menu icon) at the top-left corner
  3. Press the Linked Devices setting
  4. Press the Link a Device button
  5. Hold your phone's camera to the QR code

At the end it should print out something like this:

checking status...
updating user info...
checking derived token...
Logged-in successfully :)
Phone number (user id): <your phone number>
Session token: <session token>
Token type: 1 (TokenType.PRIMARY)

Note

  • <your phone number> and <session token> are placeholders.
  • If you already have another linked device, token type would be: 2 (TokenType.SECONDARY)
If the script fails, please check if there's an already appropriate open issue

If there isn't an open issue - feel free to open one yourself! (make sure you add the script's output and any other relevant information)

Once you have successfully logged-in, you can access any PalGate API endpoints that your account is authorized to use.

Usage

API requests require the derived token to be included in the HTTP header X-Bt-Token.

For more information on derived token, please refer to the Terminology section.

You can generate a derived token by calling pylgate.generate_token with the appropriate arguments.

For a practical demonstration, check out an example script that verifies the derived token

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GNU General Public License v3.0 (GPLv3).

You can find a copy of the license in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.en.html.

About

PalGate automation using Python

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages