2012-03-20 60 views
0

我正在将Google日历集成到我的Android应用中。用户需要授权才能访问事件信息。我使用GoogleAuthorizationRequestUrl来构建授权请求URL。的代码如下(在片断下面我替换字符串CLIENT_ID原始客户端ID):GoogleAuthorizationRequestUrl构建错误的请求网址

String url = new GoogleAuthorizationRequestUrl(CLIENT_ID, 
        "http://localhost", 
        "https://www.googleapis.com/auth/calendar.readonly").build(); 

其中GoogleAuthorizationRequestUrl建立的URL为:

https://accounts.google.com/o/oauth2/auth?b=https://www.googleapis.com/auth/calendar.readonly&client_id=CLIENT_ID&redirect_uri=http://localhost&response_type=code

代替

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/calendar.readonly&client_id=CLIENT_ID&redirect_uri=http://localhost&response_type=code

换句话说,我希望有“scope = https://www.googleapis.com/auth/c alendar.readonly“,但我有”b = https://www.googleapis.com/auth/calendar.readonly“。

奇怪的是,只有当我准备发布APK时,我才会收到错误的请求URL。在我的调试环境GoogleAuthorizationRequestUrl中构建一个正确的URL。

有没有人有这种行为的想法?

感谢, -Ali

回答

0

万一有人会读这篇文章寻找解决的办法,我得到了我implementaiton在proguard.cfg加入以下2项正在运行:

-keep class com.google.api.client.** { *; } 

-keep class com.google.api.services.calendar.model.** { *; }