我正在使用Google Play Android Developer API来服务器检查用户订阅的订阅状态,但在成功授权并要求现有订阅后,我收到401响应并显示以下消息:"当前用户没有足够的权限执行需要操作'.访问https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=XXXXXX我可以看到我确实有请求的范围(https://www.googleapis.com/auth/androidpublisher)但我仍然得到每次都有相同的反应.有没有其他人有同样的问题?
编辑:我已经看到了Explore API应用程序的功能,它在请求的查询字符串中添加了键,但我没有该值.在控制台中,我创建了一个服务帐户客户端ID,它具有客户端ID,电子邮件地址和私钥,但没有显示探索API使用的API密钥.
编辑号 2:我已将服务帐户生成的电子邮件添加到Google Play开发者控制台和Google电子钱包控制台,但我仍无法访问.我正在使用nodejs和google-oauth-jwt,因为没有谷歌为nodejs提供lib.
这是我用来发出请求的代码:
var request = require('google-oauth-jwt').requestWithJWT();
function makeReq() {
request({
url: 'https://www.googleapis.com/androidpublisher/v1.1/applications/{packageName}/subscriptions/{subscriptionId}/purchases/{purchaseToken}',
jwt: {
// use the email address of the service account, as seen in the API console
email: 'blahblahtrutjtrutj@developer.gserviceaccount.com',
// use the PEM file we generated from the downloaded key
keyFile: 'purchases-test.pem',
// specify the scopes you wish to access
scopes: ['https://www.googleapis.com/auth/androidpublisher']
}
}, function (err, res, body) {
if (err) …Run Code Online (Sandbox Code Playgroud) 我正在使用angularjs和bootstrap 3作为css构建一个Web应用程序(我对css的知识非常有限).我想创建一个内联表单,其中包含5个输入字段和标签,位于它们之上.第一场需要占据比其他场更多的空间.
我在这里尝试了一下:http ://plnkr.co/edit/a2p7RNy2SueH82WoSg5e?p=preview
这是我尝试的标记:
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<form name="form" novalidate="" ng-submit="processForm()" class="form-inline">
<div class="form-group col-md-4">
<label class="control-label" for="location"><i class="glyphicon glyphicon-map-marker"></i> Location</label>
<input class="form-control" id="location" name="location" type="text" ng-model="location" ng-required="true" ng-autocomplete details="details" options="options" placeholder="Location" />
</div>
<div class="form-group col-md-4">
<label class="control-label" for="startDate"><i class="glyphicon glyphicon-calendar"></i> Pickup date</label>
<input class="form-control" id="startDate" name="startDate" type="text" datepicker-popup="{{format}}" ng-model="startDate" is-open="openedStart" datepicker-options="dateOptions" ng-required="true" close-text="Close" ng-click="openStart($event)" />
</div>
<div class="form-group col-md-3">
<label class="control-label" for="startTime"><i class="glyphicon glyphicon-time"></i> Pickup</label>
<select class="form-control" id="startTime" ng-model="selectedStartTime" ng-options="time.label for time in times" ng-required="true"> …Run Code Online (Sandbox Code Playgroud)我正在使用Express(v4.11.2)和Passport,以支持多个提供商(本地,Facebook,Twitter和谷歌)访问我正在构建的Web应用程序.作为后端,我正在使用mysql.现在我有两个本地策略:local-signup和local-signin.我遇到的问题是req.session.passport和req.user总是空的,事实上,从不调用serializeUser和deserializeUser.
这是快递和护照的设置:
var bodyParser = require('body-parser');
var session = require('express-session');
var MemoryStore = session.MemoryStore;
var _ = require('underscore');
var passport = require('passport');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(session({
key: 'KEY',
secret: 'SECRET331156%^!fafsdaasd',
store: new MemoryStore({reapInterval: 60000 * 10}),
saveUninitialized: true,
resave: false
}));
app.use(passport.initialize());
app.use(passport.session());
require('./config/passport')(passport); // pass passport for configuration
Run Code Online (Sandbox Code Playgroud)
这是带有身份验证策略的护照文件:
module.exports = function (passport) {
passport.serializeUser(function (user, done) {
logger.info('SERIALIZE USER');
done(null, user.id);
});
passport.deserializeUser(function (id, done) {
logger.info('DESEIRALIZE USER!');
mysqllib.getConnection(function (err, connection) {
if (err) {
done(err);
}
var …Run Code Online (Sandbox Code Playgroud) node.js ×2
android ×1
angularjs ×1
css ×1
express ×1
forms ×1
google-oauth ×1
html ×1
passport.js ×1
session ×1