This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Buka Postman, pilih request login kamu (misal POST /api/auth/login). | |
2. Pergi ke tab Script | |
3. Lalu Pilih (di samping “Pre-request Script”). | |
4. masukkan Sript berikut ini: | |
const response = pm.response.json(); | |
const statuscode = pm.response.code; | |
if (statuscode == 200) { | |
console.log('token', response.data) | |
pm.collectionVariables.set("access_token", response.data.token); |