---
# System prepended metadata

title: api.cw上線流程

---

# api.cw上線流程

## 一、env

### 1. Web

```
CSR_TRIPS_DB_HOST_READ=mysql
CSR_TRIPS_DB_HOST_WRITE=mysql
CSR_TRIPS_DB_DATABASE=cw_trips
CSR_TRIPS_DB_USERNAME=root
CSR_TRIPS_DB_PASSWORD=

OAUTH_TOKEN_TTL=120

CSR_TRIPS_OAUTH_CLIENT_ID=1
CSR_TRIPS_OAUTH_CLIENT_SECRET="xxx"

LOG_SYSTEM_CODE="CW13"
```

### 2. CMS

```
WEB_API_URL="https://937d-xxx-xxx-27-126.jp.ngrok.io/api/csr-trips"
WEB_API_OAUTH_CLIENT_ID=""
WEB_API_OAUTH_CLIENT_SECRET=""
```

## 二、Cmd

```
# local產生oauth key
php artisan passport:keys

# 建立client
php artisan passport:client

# client:scope {client_id} {resouce-action} {version}
php artisan client:scope 1 "CSR-TRIPS" "company-R,industry-R" 1

php artisan client:scope 2 "CSR-TRIPS" "cache-D" 1
```

## API

### 通用

#### 1. 取得Access Token

api/v1.0/oauth/token

#### 2. 取得Web的Access Token

api/csr-trips/v1.0/oauth/web

## 其他

- [減碳溫度計：關鍵流程埋碼](https://docs.google.com/spreadsheets/d/1mUJgh4e6yp-ot0t9HILQmtmMUuRpx9SfO57XrCSuh4U/edit#gid=0)