继续获取“未经验证的使用每日限额”。继续使用需要注册“当试图谷歌加我的web应用程序登录 [英] Keep getting a "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup" when attempting to google plus login on my web app
问题描述
我试图在我的网络应用上实施Google plus注册,然后我按照google文档设置了注册,但是当我在接受权限并使用返回给我的任何api restcall后尝试注册时使返回超出未认证使用的每日限额。继续使用需要注册错误。我已经用ouath 2.0键注册了我的应用程序,所以我似乎没有明白我做错了什么。这里是我的代码。
var clientId = 5XXX000XX.apps.googleusercontent.com;
var apiKey =AIzaSyCAXE5JSa36jcC * X7HV40SBcIWBiVGUTBE;
var scopes =https://www.googleapis.com/auth/plus.login;
var accessToken = null;
函数initer(){
gapi.client.setApiKey(apiKey);
// alert(Hello init);
if($(#authorize-button)。length> 0)
$(#authorize-button)。click(onLoginClick);
function onLoginClick(){
// $(#modalLoading)。modal();
// alert(yeah);
gapi.auth.authorize({client_id:clientId,scope:scopes,immediate:false},onConnect);
}
function onConnect(authResult){
// alert(On connect);
if(authResult&&!authResult.error){
alert(Hey);
accessToken = authResult ['access_token'];
triggerLogin();
} else {
alert(Error);
triggerLogin = function(){
alert(Triggering login);
$(#modalLoading)。modal();
$ .ajax({
url:window.config.site_root +account / google_login,
type:POST,
data:access_token =+ accessToken,
成功:onLogin,
错误:function(){
onError(Logging In,starting your session);
}
});
}
onLogin =函数(登录){
alert(Login start);
$(#modalLoading)。modal(hide);
if(login.operation)
location.reload();
else {
alert(Register will start);
triggerRegistration();
$ b triggerRegistration = function(){
$(#modalLoading)。modal();
$ .ajax({
url:window.config.site_root +account / google_registration,
type:POST,
data:access_token =+ accessToken,
成功:onRegistration,
错误:function(){
alert(An Error);
}
});
onRegistration = function(data){
alert(Handling register);
$(#modalLoading)。modal(hide);
if(data.account_exists)
stage.showErrorModal(帐户已经注册,已经有一个包含该电子邮件地址的帐户,您确定使用此登录方法创建了一个帐户?
else
if(data.operation){
alert(立即登录);
triggerLogin();
}
else {
alert(Error);
onError(注册,创建您的帐户);
这是我的服务器端代码
public function google_registration()
{
$ access_token =(isset($ _ POST [access_token])&& amp ;!empty($ _ POST [access_token]))? $ _POST [access_token]:null;
$ name = null;
$ email = null;
$ account_id = null;
$ picture = null;
$ gender = null;
尝试
{
if($ access_token)
{
$ me = file_get_contents(https://www.googleapis.com/plus/ V1 /人/我的access_token = $的access_token)?。
if($ me)
{
$ me = json_decode($ me);
$ name = $ me-> name.formatted;
$ email = $ me->电子邮件;
$ account_id = $ me-> id;
$ picture = $ me-> image;
$ gender =($ me-> gender ==female)? 1:0;
$ b $ catch(Exception $ error)
{
//让系统安静地处理错误。
}
return $ this-> service_registration(google,$ name,$ email,$ account_id,$ picture,$ gender);
我也是遇到同样的错误 - 每日限制超出未认证使用量,继续使用需要注册。
我去了并检查了我的Google开发者控制台, API密钥/授权码,例如 https://console.developers.google.com/project/<您的应用ID> / apiui / api
。 Google + API的状态已设置为关闭状态。我打开了它。
然后我得到另一个访问令牌,然后尝试使用新令牌。它的工作,即错误消失了,我得到了配置文件的详细信息。为了交叉检查这是否确实是错误的原因,我又回到控制台并禁用了Google+ API。但现在,我收到了错误信息:
未配置访问权限,请使用Google Developers Console为您的项目激活API。
因此,我并不是100%确定这是在我的开发者控制台中开启/关闭Google+ API,但确实已打开。此外,开机后等待几分钟,并确保每次尝试之前都会得到新的令牌。
I'm trying to implement Google plus sign up on my web app and I followed the google docs to set up the sign up however when I attempt a signup after accepting permissions and using the access token returned to me any api restcall I make returns the Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup error. I have already signed up my app with a ouath 2.0 key, so I don't seem to get what I'm doing wrong. Here is my code.
Cient Side
var clientId = "5XXX000XX.apps.googleusercontent.com";
var apiKey = "AIzaSyCAXE5JSa36jcC*X7HV40SBcIWBiVGUTBE";
var scopes = "https://www.googleapis.com/auth/plus.login";
var accessToken = null;
function initer(){
gapi.client.setApiKey(apiKey);
//alert("Hello init");
if($("#authorize-button").length>0)
$("#authorize-button").click(onLoginClick);
}
function onLoginClick(){
//$("#modalLoading").modal();
//alert("yeah");
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, onConnect);
}
function onConnect(authResult) {
//alert("On connect");
if (authResult && !authResult.error) {
alert("Hey");
accessToken=authResult['access_token'];
triggerLogin();
} else {
alert("Error");
}
}
triggerLogin = function(){
alert("Triggering login");
$("#modalLoading").modal();
$.ajax({
url: window.config.site_root + "account/google_login",
type: "POST",
data: "access_token="+ accessToken,
success: onLogin,
error: function(){
onError("Logging In", "starting your session");
}
});
}
onLogin = function(login){
alert("Login start");
$("#modalLoading").modal("hide");
if(login.operation)
location.reload();
else{
alert("Register will start");
triggerRegistration();
}
}
triggerRegistration = function(){
$("#modalLoading").modal();
$.ajax({
url: window.config.site_root + "account/google_registration",
type: "POST",
data: "access_token="+accessToken,
success: onRegistration,
error: function(){
alert("An Error");
}
});
}
onRegistration = function(data){
alert("Handling register");
$("#modalLoading").modal("hide");
if(data.account_exists)
stage.showErrorModal("Account already registered", "There is already an account with that email address, are you sure you created an account using this login method?");
else
if(data.operation){
alert("Login now");
triggerLogin();
}
else{
alert("Error");
onError("Registering", "creating your account");
}
}
Here is my server side code
public function google_registration()
{
$access_token = (isset($_POST["access_token"]) && !empty($_POST["access_token"])) ? $_POST["access_token"] : null;
$name = null;
$email = null;
$account_id = null;
$picture = null;
$gender = null;
try
{
if($access_token)
{
$me = file_get_contents("https://www.googleapis.com/plus/v1/people/me?access_token=".$access_token);
if($me)
{
$me = json_decode($me);
$name = $me->name.formatted;
$email = $me->email;
$account_id = $me->id;
$picture = $me->image;
$gender = ($me->gender == "female") ? 1 : 0;
}
}
}
catch(Exception $error)
{
// let the system handle the error quietly.
}
return $this->service_registration("google", $name, $email, $account_id, $picture, $gender);
}
I too ran into the same error - "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup".
I went and checked my google developer console under APIs for the project associated with the API key/ auth key, eg, https://console.developers.google.com/project/<your app id>/apiui/api
. The status for Google+API was set to OFF. I turned it ON.
I then got another access token, and then tried with the new one. It worked, ie, the error was gone and I got the profile details. To cross-check if that was indeed the cause of the error, I went back to console and disabled Google+ API. But now, I get the error:
"Access Not Configured. Please use Google Developers Console to activate the API for your project."
So, I am not 100% sure that it was the turning on/off of the Google+ API in my developer console, but do ensure that this is turned on. Also, wait a few minutes after turning on, and ensure that you get a fresh token each time before trying it.
这篇关于继续获取“未经验证的使用每日限额”。继续使用需要注册“当试图谷歌加我的web应用程序登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!