Skip to content

Instantly share code, notes, and snippets.

View KimGenius's full-sized avatar
🧞
Working from lamp

KIM YOUNGJAE KimGenius

🧞
Working from lamp
View GitHub Profile
{
"access_token": "eyGciOiNiIsIkpXVCJ9.eyJ0NTY3ODkwIiwibWRtaW4iOnRydWV9...",
"refresh_token": "ciOiJIUzI1NkpXVCJ9.dWIiOiIxMjM0Y3ODIiwibmFtZSIkpv4gR...",
"scope": [ "message:write" ],
"token_type": "Bearer"
}
res.cookie('APP_COOKIE', result.access_token, {
'httpOnly': false,
'signed': false,
'encode': String
})
<!doctype html>
<html>
<head>
<title>문자 발송</title>
</head>
<body>
<form action="/send" method="post">
<input type="text" placeholder="발신번호" name="from">
<input type="text" placeholder="수신번호" name="to">
<input type="text" placeholder="내용" name="text">
const bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({
extended: true
}))
app.post('/send', async (req, res) => {
const { from, to, text } = req.body
const { APP_COOKIE } = req.cookies
const result = await request({
method: 'POST',
uri: 'https://api.solapi.net/messages/v4/send',
headers: {
'Authorization': `bearer ${APP_COOKIE}`
},
body: {