I am using this url to get the accesstoken

http://www.googleapis.com/plus/v1/people/me?access_token?client_id=*********.ps.googleusercontent.com&redirect_uri=http://localhost:49261/Default.aspx&client_secret=*******************

Here are the steps I'm using

Getting a code in authorization

string url = string.Format("{0}?client_id={1}&redirect_uri={2}", AUTHORIZE, this.ConsumerKey, CALLBACK_URL);

url += "&scope=https://www.googleapis.com/auth/plus.me&response_type=code";

The above url returns a code and using that code I am using

exchange the code for a accesstoken.

http://www.googleapis.com/plus/v1/people/me?access_token?client_id=*********.ps.googleusercontent.com&redirect_uri=http://localhost:49261/Default.aspx&client_secret=*******************

Here's my code to get the accesstoken

public void AccessTokenGet(string authToken)

{

this.Token = authToken;

string accessTokenUrl = string.Format("{0}?client_id={1}&redirect_uri={2}&client_secret={3}&code={4}",

ACCESS_TOKEN, this.ConsumerKey, CALLBACK_URL, this.ConsumerSecret, authToken);

string response = WebRequest(Method.GET, accessTokenUrl, String.Empty);

if (response.Length > 0)

{

//Store the returned access_token

NameValueCollection qs = HttpUtility.ParseQueryString(response);

if (qs["access_token"] != null)

{

this.Token = qs["access_token"];

}

}

}

public string WebRequest(Method method, string url, string postData)

{

HttpWebRequest webRequest = null;

StreamWriter requestWriter = null;

string responseData = "";

webRequest = System.Net.WebRequest.Create(url) as HttpWebRequest;

webRequest.Method = method.ToString();

webRequest.ServicePoint.Expect100Continue = false;

webRequest.UserAgent = "[You user agent]";

webRequest.Timeout = 20000;

if (method == Method.POST)

{

webRequest.ContentType = "application/x-www-form-urlencoded";

//POST the data.

requestWriter = new StreamWriter(webRequest.GetRequestStream());

try

{

requestWriter.Write(postData);

}

catch

{

throw;

}

finally

{

requestWriter.Close();

requestWriter = null;

}

}

responseData = WebResponseGet(webRequest);

webRequest = null;

return responseData;

}

public string WebResponseGet(HttpWebRequest webRequest)

{

StreamReader responseReader = null;

string responseData = "";

try

{

responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());

responseData = responseReader.ReadToEnd();

}

catch (Exception ex)

{

throw ex;

}

finally

{

webRequest.GetResponse().GetResponseStream().Close();

responseReader.Close();

responseReader = null;

}

return responseData;

}

It fails in the WebResponseGet method. Returns a HTTP 403 forbidden

EDIT:

probably I wasn't clear earlier. To explain the error here's what its is

The code fails on its request for access token

error: {

"error": {

"errors": [

{

"domain": "usageLimits",

"reason": "dailyLimitExceededUnreg",

"message": "Daily Limit Exceeded. Please sign up",

"extendedHelp": "https://code.google.com/apis/console"

}

],

"code": 403,

"message": "Daily Limit Exceeded. Please sign up"

}

}

c# forbidden.html,c# - google+ api error forbidden 403 - Stack Overflow相关推荐

  1. 为什么程序员一定要会用Google和Stack Overflow?

    为什么程序员一定要会用Google和Stack Overflow?  程序员联盟 关注 2017.01.05 01:43* 字数 2146 阅读 9160评论 40喜欢 140 作者 谢恩铭 转载请注 ...

  2. 记一次spring security403错误:{“timestamp“:“2022-06-30 14:05:32“,“status“:403,“error“:“Forbidden“,“mess...

    错误描述: 用PostMan第一次访问登录接口[加入了白名单]正常,再点击登录,报403错误 错误如下: {         "timestamp": "2022-06- ...

  3. android编译error, forbidden warning出错问题解决

    android编译Kernel时,从高版本GCC起,就开始把warning作为error对待,比如我们遇到: gsl3670.c:2065:21: warning: unused variable ' ...

  4. android 编译 oserror,编译android kernel时,关闭error, forbidden warning

    编译android kernel时,遇到error, forbidden warning sound/soc/codecs/es8323.c:1249:12: warning: 'entry_read ...

  5. warning: initialization from incompatible pointer type error, forbidden解决

    android kernel报错: warning: initialization from incompatible pointer type error, forbidden warning:xx ...

  6. 解决Python中加载sklearn人脸数据集出现的fetch_olivetti_faces HTTPError: HTTP Error : Forbidden

    解决Python中加载sklearn人脸数据集出现的fetch_olivetti_faces HTTPError: HTTP Error : Forbidden 在使用Python进行机器学习或深度学 ...

  7. Jsch访问代理机报proxy error:Forbidden

    Jsch访问代理机报proxy error:Forbidden 问题解释 通过代理访问物理机被拒绝 原因分析 代理机用户名.端口错误或物理机用户名.端口.密码错误 代理机或物理机代理端口未开放 问题处 ...

  8. xcode上真机调试iphone4s出现“There was an internal API error.”解决方案

    xcode7更新之后使用真机调试,在IOS8的一台Iphone5手机上面没什么问题,IOS8的一台iphone6也没问题.但是在IOS6的一台Iphone4s和 IOS7的ipad air2上面在最后 ...

  9. WordZ:Word终结者,基于Google API的文档自动化 电子合同发票流水账单线上集成方案

    WordZ: Word终结者, 基于Google API开发的文档自动化产品.可用于线上合同,发票,所有有关文档的业务流程.主要功能包含,创建,复制文档,填充变量,导出word,导出pdf等一系列优秀 ...

最新文章

  1. ios传值给js_IOS中plus.ios.implements实现OC方法后,在OC中回调传值后JS端无法正确获取...
  2. 经典:盘点80后男人找老婆的20条标准
  3. FileBuffer 与 ImageBuffer 互相转换(滴水PE作业)
  4. 计算机基础知识统考12月份,(精)2016年12月份电大统考计算机考前辅导基础知识考试小抄【呕心沥血整理,值得一看哦!】.doc...
  5. python函数五要素_Python安装及关键要素
  6. 华为硬件工程师社招机考题库_中级会计机考你了解吗?机考操作常见八大问题速看...
  7. 第四周Java学习总结
  8. (转)理解SQLSERVER中的排序规则
  9. 手把手教你搭建Jenkins+Jmeter+Ant自动化集成环境
  10. 使用Linux 显示日历 cal -y (可以快速制作简易万年历)
  11. 深入理解JAVA锁的机制
  12. go java 垃圾回收_JAVA什么时候执行垃圾回收以及回收流程-Go语言中文社区
  13. 调试器无法终止一个或多个进程_EXCEL按多个分隔符号无法分列,没关系,一个M函数全搞定...
  14. EXCEL函数LookUp, VLOOKUP,HLOOKUP应用详解(含中文参数解释)
  15. 解决Iphonex 底部按钮fixed,bottom:0 底部留白问题
  16. ICPC 2015 北京 Today Is a Rainy Day
  17. 目标检测之FCOS算法分析
  18. 汽车UDS诊断教程 ISO15765(十)
  19. WIN7下使用超级终端
  20. hdu5445 Food Problem(多重背包)(*)

热门文章

  1. koa2 mysql_koa2+vue+mysql 全栈开发记录
  2. html div三角形,css+div打造三角形(箭头)
  3. java分布式架构的发展
  4. python之字典的操作
  5. 3层vni vxlan_什么是VXLAN 三层网络搭建二层网络的设计方案
  6. 在自己的电脑上搭建服务器(可供对外访问)
  7. nginx部署两个php虚拟主机,nginx服务器,fastcgi模式,添加虚拟主机(多站点)配置...
  8. OpenShift 4 - DevSecOps Workshop (2) - 运行一个基于Tekton的Pipeline示例
  9. ASP.NET Core 3.1 Web API和EF Core 5.0 中具有泛型存储库和UoW模式的域驱动设计实现方法
  10. android 接口报错409,android 在调用微信刷脸获取用户信息时,在还未完成识别时点击退出,WxPayFace 停止应用...