Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Gojek API Configuration
# Copy this file to .env and fill in your values

# Required: Your phone number (without country code prefix)
# Example: 81234567890
GOJEK_PHONE_NUMBER=

# Required: Client credentials
GOJEK_CLIENT_ID=gojek:consumer:app
# Obtain by decompiling the Gojek APK
GOJEK_CLIENT_SECRET=
# X-E1 is per-request and cannot be replayed — leave blank unless you have a live capture tool
Comment thread
clawdiab marked this conversation as resolved.
Outdated
# GOJEK_X_E2=
16 changes: 13 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ jspm_packages
# Optional REPL history
.node_repl_history

example/

.idea/
.idea/

# Captured traffic and tokens (PII)
gojek_*.json
all_traffic*.log

# Sensitive files
.env
*.apk
*.xapk
*.cer
*.pem
__pycache__/
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,46 @@ you can see list of package [here](https://github.com/mychaelgo?tab=packages&rep

Part of my [personal finance automation](https://github.com/mychaelgo/personal-finances-automation)

## Setup

### 1. Environment Variables

Copy `.env.example` to `.env` and fill in your credentials:

```bash
cp .env.example .env
```

Required variables:
- `GOJEK_CLIENT_SECRET` — Obtain by decompiling the latest Gojek APK using [apktool](https://apktool.org/) or [jadx](https://github.com/skylot/jadx)
- `GOJEK_PHONE_NUMBER` — Your phone number (without country code)
- `GOJEK_ACCESS_TOKEN` — Obtained after completing the OTP login flow (for API/GoPay endpoints)

Optional variables (have sensible defaults):
- `GOJEK_CLIENT_ID` — defaults to `gojek:consumer:app`
- `GOJEK_APP_VERSION` — update to match the APK version you decompiled
- `GOJEK_UNIQUE_ID` — auto-generated if not set

### 2. Obtaining Credentials from APK

```bash
# Download latest Gojek APK from APKMirror or APKPure
# Decompile with jadx
jadx -d output/ gojek.apk

# Search for client_secret
grep -r "client_secret" output/
grep -r "<YOUR_CLIENT_SECRET>" output/
```

### 3. Authentication Flow

1. Set `GOJEK_CLIENT_SECRET` and `GOJEK_PHONE_NUMBER` in `.env`
2. Run `node examples/node/goid/auth.js` to request OTP
3. Enter the OTP received via WhatsApp/SMS to generate tokens
4. Set `GOJEK_ACCESS_TOKEN` in `.env` with the received `access_token`
5. Now you can use the API and GoPay examples

## Documentation

All API documented in [docs directory](docs/) with OpenAPI format v3.0
Expand All @@ -38,6 +78,14 @@ After setup complete, now you install any package you want.
npm install @mychaelgo/goid-gojek
npm install @mychaelgo/gopay-gojek
npm install @mychaelgo/api-gojek
npm install @mychaelgo/gojek-auth
```

You also need `dotenv` for the examples. If you are running them from the repository root, initialize a Node project first:

```bash
npm init -y
cd examples/node/goid && npm install dotenv
Comment thread
clawdiab marked this conversation as resolved.
Outdated
```

### Using Go
Expand Down
Loading