谷歌日历redirect_uri_mismatch [英] Google Calendar redirect_uri_mismatch
问题描述
我在Visual Studio中前preSS 2012的Web网站。
I have a website in Visual Studio Express 2012 for Web.
我不断收到来自谷歌的错误,说有不匹配的URI在开发者控制台上市的时候我尝试下面的code中的重定向:
I keep getting an error from google which says there isn't a match for the redirect uri's listed in the developer console when I try the code below:
private void getEvents()
{
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "CLIENTIDHERE",
ClientSecret = "SECRETHERE",
},
new[] { CalendarService.Scope.Calendar },
"user",
CancellationToken.None).Result;
// Create the service.
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential
});
List<Event> x = service.Events.List("primary").Execute().Items.ToList();
}
我已经尝试设置默认端口8080在Visual Studio和我的开发者控制台中列出的URI的如下:
I have already tried setting the default port to 8080 in visual studio and the URI's listed in my developer console are as follows:
http://localhost:8080/QFC/Coach/Manageusers.aspx
http://localhost:8080/QFC/*
http://localhost:8080/oauth2callback
http://localhost:8080/oauth2callback/
http://localhost:8080/authorize
http://localhost:8080/authorize/
http://localhost:8080/signin-google
上面提到的code从 HTTP叫做://本地主机:8080 / QFC /教练/ Schedule.aspx
页上的负荷。
每次我得到错误的端口号是不同的,我不知道为什么。
例如的http://本地主机:57002 /授权/
没有匹配的注册
The code mentioned above is called from http://localhost:8080/QFC/Coach/Schedule.aspx
on page load.
Each time I get the error the port number is different and I have no idea why.
e.g. http://localhost:57002/authorize/
did not match a registered
我现在用的是.NET API与C#
我需要知道它为什么这样做,以及如何解决它。
推荐答案
新增的http://本地主机/授权/
到允许的URI的列表。这在某种程度上使得谷歌验证忽视的端口。但它的作品!
Added http://localhost/authorize/
to the list of allowed URI's. This somehow makes google verification ignore the port. But it works!
这篇关于谷歌日历redirect_uri_mismatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!