【发布时间】:2019-03-04 13:28:43
【问题描述】:
我需要使用 Google Play Android API,我按照很多说明与 API 连接但我阻止了一个。(Authorization documentation) 就在第 4 步,他们说:
使用此代码发送帖子:
grant_type=authorization_code
code=<the code from the previous step>
client_id=<the client ID token created in the APIs Console>
client_secret=<the client secret corresponding to the client ID>
redirect_uri=<the URI registered with the client ID>`
我指定我使用无服务器和节点,我该如何在https://accounts.google.com/o/oauth2/token 中拥有我的刷新令牌?
非常感谢我的英语^^。
抱歉这个疏忽,我的 serverless 就是这样
#serverless.yml
service: scrapper-app
provider:
name: aws
runtime: nodejs8.10
region: eu-west-3
functions:
app:
handler: index.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
我的 js 也是这样:
//index.js
const serverless = require('serverless-http');
const express = require('express')
const app = express()
//API
const { google } = require('googleapis');
const oauth2Client = new google.auth.OAuth2(
IDCLient,
Secret,
'https://accounts.google.com/o/oauth2/auth',
);
const scopes = 'https://www.googleapis.com/auth/androidpublisher';
const url = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: scopes
)}
// GET
app.get('/', function (req, res) {
res.send('Scrapper Rs!');
})
module.exports.handler = serverless(app);
我真的不知道如何使用节点和无服务器进行 http-post,我成功使用数据库(使用 curl)但不发布到 url。
【问题讨论】:
-
你好乔丹,欢迎来到 stackoverflow。您能否提供更完整的代码概述,以便我们更好地确定您可能遗漏了什么?
标签: javascript node.js amazon-web-services token serverless