Skip to content

Instantly share code, notes, and snippets.

💤
Working from ?

GeniusK KimGenius

💤
Working from ?
Block or report user

Report or block KimGenius

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.js
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: {
View index.js
const bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({
extended: true
}))
View send.ejs
<!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">
View index.js
res.cookie('APP_COOKIE', result.access_token, {
'httpOnly': false,
'signed': false,
'encode': String
})
View result.json
{
"access_token": "eyGciOiNiIsIkpXVCJ9.eyJ0NTY3ODkwIiwibWRtaW4iOnRydWV9...",
"refresh_token": "ciOiJIUzI1NkpXVCJ9.dWIiOiIxMjM0Y3ODIiwibmFtZSIkpv4gR...",
"scope": [ "message:write" ],
"token_type": "Bearer"
}
View index.js
const request = require('request-promise')
app.get('/authorize', (req, res) => {
const { code } = req.query
const result = await request({
method: 'POST',
uri: 'https://api.solapi.net/oauth2/v1/access_token',
body: {
code,
grant_type: 'authorization_code',
You can’t perform that action at this time.