我们对App Engine对Google Cloud Endpoints的支持感到非常兴奋.
也就是说我们还没有使用OAuth2,并且通常使用用户名/密码对用户进行身份验证,以便我们可以支持没有Google帐户的客户.
我们希望将API迁移到Google Cloud Endpoints,因为我们可以免费获得所有好处(API控制台,客户端库,健壮性......),但我们的主要问题是......
如何向我们之前在现有API中检查有效用户会话+ CSRF令牌的云端点添加自定义身份验证.
有没有一种优雅的方法来实现这一点,而无需在protoRPC消息中添加会话信息和CSRF令牌等内容?
我是否认为Cloud Endpoints的优点具有以下限制:
有没有计划取消这些限制?如果是,那么ETA是什么?
java authentication google-app-engine authorization google-cloud-endpoints
几天前,我开始使用Google App Engine和Google Cloud Endpoints开发移动应用后端.本教程将介绍如何自动生成端点,以及Android的客户端库.
所以我们有我们的实体:
@Entity
public class Person implements IsSerializable{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
private String name;
//...
}
Run Code Online (Sandbox Code Playgroud)
这个类的端点:
@Api(name = "personendpoint")
public class PersonEndpoint {
@ApiMethod(name = "getPerson")
public Person getPerson(@Named("id") Long id) {
...
Run Code Online (Sandbox Code Playgroud)
此外,使用生成的Android端点库(使用REST API)我想在服务器上添加用户界面,使用Google Web Toolkit(GWT)构建.但是我应该如何操作服务器端的日期?我可以看到不同的方法......
选项A1:在GWT中添加RPC服务
public interface PersonServiceAsync {
void insertPerson(Person person, AsyncCallback<Person> callback);
}
@RemoteServiceRelativePath("api")
public interface PersonService extends RemoteService {
public Person insertPerson(Person person);
}
public class PersonServiceImpl …Run Code Online (Sandbox Code Playgroud) 我正在尝试决定使用哪个选项.(或者如果更好的话,则为另一个)这适用于消息类型的应用程序,其中会有大量的通知和数据库写入.
选项1 - 使用云端点和云数据存储
优势的Google App Engine :
缺点:
选项2 - Firebase
专业人士:
缺点:
选项3 - 是否可以组合Google Cloud Endpoints和Firebase?
我需要一些帮助来设置Google Cloud Endpoints的单元测试.使用WebTest所有请求都回答AppError:错误响应:404 Not Found.我不确定端点是否与WebTest兼容.
这是应用程序的生成方式:
application = endpoints.api_server([TestEndpoint], restricted=False)
Run Code Online (Sandbox Code Playgroud)
然后我用这种方式使用WebTest:
client = webtest.TestApp(application)
client.post('/_ah/api/test/v1/test', params)
Run Code Online (Sandbox Code Playgroud)
使用curl进行测试工作正常.
我应该为端点编写不同的测试吗?GAE Endpoints团队的建议是什么?
python google-app-engine unit-testing google-cloud-endpoints
我正在使用eclipse插件开发一个app-engine连接的android项目.该应用程序的一个方面是允许用户Alpha将图片发送给用户Bravo.为此,我有以下设置:
用户Alpha发布:
用户Bravo获得:
这个设置需要两(2)分钟,从我的Android应用程序发送图像到我可以在blob疼痛中看到它.不用说这是完全不可接受的.
我的服务器通过以下代码以编程方式处理图像:
public static BlobKey toBlobstore(Blob imageData) throws FileNotFoundException, FinalizationException, LockException, IOException {
if (null == imageData)
return null;
// Get a file service
FileService fileService = FileServiceFactory.getFileService();
// Create a new Blob file with mime-type "image/png"
AppEngineFile file = fileService.createNewBlobFile("image/jpeg");// png
// Open a channel to write to it
boolean lock = true;
FileWriteChannel writeChannel = fileService.openWriteChannel(file, lock);
// This time we write to the channel directly
writeChannel.write(ByteBuffer.wrap
(imageData.getBytes()));
// …Run Code Online (Sandbox Code Playgroud) google-app-engine android blobstore gae-eclipse-plugin google-cloud-endpoints
我花了一天的时间才使它成功,所以我认为我的经验可能对某人有用.也许其他一些人会找到改进.
所以我两天前开始使用angularJS.我希望它可以与Google Cloud Endpoints一起使用来创建后端界面.这给我带来了麻烦.
gapi的javascript客户端带有异步加载,因此角度初始化会因为gapi未定义而崩溃.
所以你需要在初始化gapi时引导角度:
<script src="https://apis.google.com/js/client.js?onload=googleOnLoadCallback"></script>添加回调:
function googleOnLoadCallback(){
var apisToLoad = 1; // must match number of calls to gapi.client.load()
var gCallback = function() {
if (--apisToLoad == 0) {
//Manual bootstraping of the application
var $injector = angular.bootstrap(document, ['myApp']);
console.log('Angular bootstrap complete ' + gapi);
};
};
gapi.client.load('helloWorld', 'v1', gCallback, '//' + window.location.host + '/_ah/api');
}
Run Code Online (Sandbox Code Playgroud)感觉很好,但电话怎么样?
所以这是控制器:
angular.module('myApp.controllers', []).
.controller('MyCtrl', ['$scope' ,'helloWorldService',
function($scope,greetingsService) {
helloWorldService.loadData($scope);
}]);
Run Code Online (Sandbox Code Playgroud)
这是服务:
angular.module('myApp.services', [])
service('helloWorldService', [function() { …Run Code Online (Sandbox Code Playgroud) javascript google-app-engine angularjs google-cloud-endpoints gapi
protorpc当我使用端点时,我会收到一些奇怪的错误.在这段代码中:
class Application(EndpointsModel):
_message_fields_schema = ('id', 'name')
created = ndb.DateTimeProperty(auto_now_add=True)
name = ndb.StringProperty()
roles = ndb.IntegerProperty(repeated=True)
updated = ndb.DateTimeProperty(auto_now=True)
owner = ndb.KeyProperty(kind='User')
@API.api_class(resource_name="application")
class ApplicationApi(protorpc.remote.Service):
@Application.method(http_method="GET",
request_fields=('id',),
name="get",
path="applications/{id}")
def ApplicationGet(self, instance):
if not instance.from_datastore:
raise endpoints.NotFoundException("Application not found.")
return instance
@Application.query_method(http_method="GET",
query_fields=('limit', 'order', 'pageToken'),
name="list",
path="applications")
def ApplicationList(self, query):
return query
Run Code Online (Sandbox Code Playgroud)
当我调用application.get()错误时如下:( 完全跟踪):
TypeError:只能从确切类型为Application的实体进行复制.收到了一个Application实例.
并且调用application.list()错误如下:( 完全跟踪):
ValidationError:
<class '.Application'>找到的字段项的预期类型<Application name: u'test'>(类型<class '.Application'>)
可能是什么导致了这个?我的其他模型具有几乎相同的代码(只是不同的属性)工作正常.
python google-app-engine protorpc google-cloud-endpoints endpoints-proto-datastore
这看起来像一个愚蠢的问题,看起来我似乎没有找到答案但是.
问题是我正在开发一个Android应用程序,并且在某个时刻我是新的
Google Cloud SQL
和
Google App Engine
所以我看了20-30教程并开始实现,但现在我卡住了,可以找到没有教程,显示一步一步的简单的Android代码.
这就是我所做的以及我现在所处的位置:
-my android app工作得很好,没有一个错误
- 创建了一个app引擎项目
- 转而使用Google Cloud SQL服务及其API服务,并为此付费
- 在云中创建一个实例
- 并且"通过api控制台"在我的实例中创建了一个表和一个小数据库
生成为我的应用程序包支持的App Engine
而这就是我被卡住的地方!我不知道如何使用生成的文件,如何工作,如何通过我的应用程序访问云中的表,可以找到解释如何发生的教程,所有教程都跳过这一步,就像它是世界上最简单的事情.
我只是想知道事情是如何协同工作的?在哪里使用方法,我需要做什么才能从云中的实例中的表中获取数据...
我甚至会感谢任何链接:)谢谢.
我目前刚进入AppEngine世界,并希望使用Cloud Endpoints为我正在开发的移动应用程序创建后端.
我现在的一个问题是关于用户的身份验证.我一直在关注App Engine上的Udacity的MOOC,他们教我们如何使用Google帐户验证用户的API请求.在后端,我们只需要在User我们的方法中添加一个参数,并检查用户是否已登录.据我所知,此用户参数由App Engine根据Authorization我们的请求标题生成.(可能需要一些确认)
现在,有一些我不确定理解的东西,并没有在这个MOOC上得到很好的解释.
现在,我想知道这是否与Google之外的其他OAuth方案兼容?那么,如果我想实现Facebook身份验证,我会简单地传递facebook访问令牌吗?
根据我搜索的内容,在Android上使用Facebook SDK会让我能够生成一个用户访问令牌,用于识别我的用户到Facebook.将它发送到我的后端后,我想检查它与Facebook的有效性,如果它有效,请为我的应用程序创建一个新用户.现在,我还想生成一个新标记,用于标识我的应用程序的用户.我需要做什么?
authentication google-app-engine android facebook-graph-api google-cloud-endpoints