相关疑难解决方法(0)

C#Web - localhost:端口工作,127.0.0.1:port不起作用

我刚刚将C#Web API组件(Web API模型和控制器)添加到localhost现有项目的副本中.

应该从Android应用程序调用此Web API的GET方法.在这个链接中,它解释了我应该10.0.2.2在Android模拟器上使用它来获取计算机127.0.0.1.

当我这样做时,它在Android应用程序中对我的HttpRequest不起作用.所以我去了Android浏览器并直接键入它,它也没有用.

然后我尝试使用127.0.0.1而不是localhost在我的计算机的浏览器中,并且由于一些未知的原因它也不起作用..是否有不同的localhost127.0.0.1?我一直认为他们是同一个人.

这是400 error我在使用时获得的127.0.0.1: 127.0.0.1错误400错误请求

并与localhost一切工作正常.

所以,我的问题:我如何使用localhost的仿真器(或者,如何解决使用时,我得到的错误127.0.0.1,而不是localhost)?另外,我想知道的区别localhost127.0.0.1,因为我一直以为他们是一样的.

在此先感谢您的回复.


编辑1:

这个stackoverflow问题中,他们提到了System32Windows中的主机文件.我打开用记事本文件++(如管理员),并注释掉线127.0.0.1 localhost::1 localhost.但不幸的是,这并没有解决问题,我仍然不能127.0.0.1在我的电脑上用作替代品localhost.可能是因为我的问题是相反的(我可以访问localhost,但不是127.0.0.1,而不是相反.)


编辑2:

这个stackoverflow回答中,它解释了localhost和之间的区别127.0.0.1是:

  • 127.0.0.1 在某些编程语言中,将更容易被识别为IP.
  • localhost可以更改为计算机主机文件中的另一个IP(我的编辑1中提到的文件).
  • IPv4和IPv6之间存在一些差异.

所有我现在都明白了这些差异,我只是不明白为什么我的localhost正在工作,但127.0.0.1不是.. …

c# android localhost android-emulator asp.net-web-api

35
推荐指数
3
解决办法
3万
查看次数

Google OAuth2授权OAuth令牌错误:redirect_uri_mismatch

我正在根据此网页创建和授权OAuth令牌:https://code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough

但是我收到了这个错误:redirect_uri_mismatch.

The redirect URI in the request: urn:ietf:wg:oauth:2.0:oob did not match a registered redirect URI
from_login=1
cookie_policy_enforce=false
scope=https://mail.google.com/
response_type=code
access_type=online
redirect_uri=urn:ietf:wg:oauth:2.0:oob
as=-80019291b2cb8ed
display=page
pli=1
client_id=......
authuser=0
hl=en
Run Code Online (Sandbox Code Playgroud)

我认为这可能会有所帮助:Google OAuth 2授权 - 错误:redirect_uri_mismatch

但是当我尝试将重定向url注册到我的控制台时,我被告知该url无效.

oauth-2.0 google-oauth

20
推荐指数
6
解决办法
4万
查看次数

Google OAuth 2.0"错误":"redirect_uri_mismatch"

我已经花了一天,撞了一杯,我真的很生气,我不明白谷歌想要什么,有什么不对.

我在开发者控制台中启用了Google+ Api google_ api已启用 ,创建了新的OAuth客户端ID 客户ID

    $ch = curl_init('https://accounts.google.com/o/oauth2/token');
curl_setopt($ch,CURLOPT_POSTFIELDS,'code=4%2FPp1GWqC6PIr3wNYrZ5kK4T9oitxBoo0fBqBrVNQfE-g.ElKDUjQ7E28SoiIBeO6P2m-0RPaolgI&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fmyprivatedomain.local.com%2Foauth2callback&client_id=%mycliet_id%&client_secret=%mysecret%');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
var_dump(curl_exec($ch));
Run Code Online (Sandbox Code Playgroud)

在此处的说明中创建了所有内容:https://developers.google.com/+/web/signin/server-side-flow,gplus按钮显示在页面上,并成功请求授权用户访问.但是,当我执行第8 步时:初始化Google API客户端库并在 每次获得响应"错误"启动Google+服务我的请求:"redirect_uri_mismatch"

我知道,当您未在Google控制台中注册redirect_uri时,或者当您在其中输入类型错误时,会出现此错误,但我已将其注册,并且仅用于测试尝试设置不同的网址(更改的域名,更改的协议来自https到https),但它永远不会工作!我不知道还能检查什么,请至少建议一下.

oauth google-api-php-client google-oauth2

14
推荐指数
1
解决办法
6万
查看次数

Google登录Storagerelay URI不允许用于' NATIVE' 客户类型

按照本教程,我一直在尝试这个简单的谷歌登录:

代码非常简单,我正在按照这些教程中给出的相同步骤进行操作,但最终出现了以下错误.


400. That’s an error.

Error: invalid_request

Storagerelay URI is not allowed for 'NATIVE' client type
Run Code Online (Sandbox Code Playgroud)

'NATIVE'不允许使用Storagerelay URI

在我的凭据中,我有如下配置:

凭证配置

我的代码如下:

<meta name="google-signin-client_id" content="377345478968-2opk94iompa38gja0stu1vi821lr3rt0.apps.googleusercontent.com">
<script src="https://apis.google.com/js/client:platform.js?onload=renderButton" async defer></script>

<div id="gSignIn"></div>


function onSuccess(googleUser) {
    var profile = googleUser.getBasicProfile();
    gapi.client.load('plus', 'v2', function () {
        var request = gapi.client.plus.people.get({
            'userId': 'me'
        });
        //Display the user details
        request.execute(function (resp) {
            console.log(resp);
        });
    });
}
function onFailure(error) {
    alert(error);
}
function renderButton() {
    gapi.signin2.render('gSignIn', {
        'scope': 'profile email',
        'width': 240,
        'height': 50,
        'longtitle': true,
        'theme': …
Run Code Online (Sandbox Code Playgroud)

javascript google-signin googlesigninaccount

10
推荐指数
1
解决办法
6445
查看次数

9
推荐指数
1
解决办法
2927
查看次数

使用youtube api v3继续获取错误:redirect_uri_mismatch

嗨,我希望有人可以帮助我.

我在本地计算机上有一个Web应用程序(asp.net),我正在尝试使用此示例将视频上传到YouTube https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video

当我尝试上传视频时,我在Google控制台中为Web应用程序设置了客户端ID和密码,打开浏览器选项卡以选择我的一个Google帐户,一旦我输入,我获取redirect_uri_mismatch,该页面上的响应详细信息如下:

cookie_policy_enforce=false
scope=https://www.googleapis.com/auth/youtube.upload
response_type=code
access_type=offline
redirect_uri=http://localhost:55556/authorize/
pageId=[some page id removed here for security reasons]
display=page
client_id=[some unique id removed here for security reasons].apps.googleusercontent.com
Run Code Online (Sandbox Code Playgroud)

一个有趣的事情是,它与redirect_uri=http://localhost:55556/authorize/ Google控制台中设置的完全不同,而client_secrets.json中的设置也与我每次收到端口号更改的错误页面完全不同.

redurect网址和来源在Google控制台中设置如下我想我已添加所有组合以防万一:

授权重定向URI

http://localhost/
https://localhost/
http://localhost:50169/AddContent.aspx
https://localhost:50169/AddContent.aspx
http://localhost:50169
Run Code Online (Sandbox Code Playgroud)

授权的JavaScript起源

http://localhost/
https://localhost/
http://localhost:50169/
https://localhost:50169/
Run Code Online (Sandbox Code Playgroud)

我不确定为什么错误页面上的redirect-uri与我在Google控制台中指定的任何授权重定向URI都不匹配?有任何想法吗 ?

也有可能在Google控制台和我的代码中正确设置了所有内容,但这个错误是由其他东西触发的,例如我错过了我的管帐号上的一些设置?我没有进行任何设置更改,因为我不认为我必须更正?

c# youtube google-api oauth-2.0

8
推荐指数
1
解决办法
7919
查看次数

Google OAuth 2 错误 400:redirect_uri_mismatch 但重定向 uri 合规且已在 Google Cloud Console 中注册

我正在开发一个 NextJS 应用程序,使用 next-auth 并使用 Google Oauth 2 作为其身份验证提供程序。生产版本正在 Heroku 上运行。当尝试登录我的生产版本时,Google OAuth 为我提供了"Error 400: redirect_uri_mismatch". 通常,这很容易修复,除非确切的 uri 已在 Cloud Console 中注册。

\n

查看我的云控制台配置

\n

我还尝试添加我的 uri 的许多不同排列,但这没有帮助。

\n

1148527169151061未解决此问题。

\n

问题中的错误:

\n
Error 400: redirect_uri_mismatch\n\nYou can\'t sign in to this app because it doesn\'t comply with Google\'s OAuth 2.0 policy.\n\nIf you\'re the app developer, register the redirect URI in the Google Cloud Console.\n\nRequest Details\nIf you\xe2\x80\x99re the app developer, make sure that these request details comply …
Run Code Online (Sandbox Code Playgroud)

heroku oauth-2.0 google-oauth google-cloud-platform next-auth

8
推荐指数
2
解决办法
1万
查看次数

Firebase中的自定义authDomain

我正在将Firebase的内置oAuth功能用于SPA。

例如,此SPA属于自己的域名 foobar.com

问题是,当打开oauth弹出窗口时,将使用旧foobar.firebaseapp.com域而不是新foobar.com

我的init看起来像这样

firebase.initializeApp({
  apiKey: '...',
  authDomain: 'foobar.firebaseapp.com',
  databaseURL: 'https://foobar.firebaseio.com',
  storageBucket: 'foobar.appspot.com',
  messagingSenderId: '123456'
})
Run Code Online (Sandbox Code Playgroud)

我猜authDomain可能与它有关,但是如果我将其更改foobar.com为错误:

 code: "auth/popup-closed-by-user", message: "The popup has been closed by the user before finalizing the operation."}
Run Code Online (Sandbox Code Playgroud)

简而言之,有没有一种方法可以自定义Firebase的oAuth网址?

firebase firebase-authentication

7
推荐指数
2
解决办法
5423
查看次数

从本地主机发送请求时,Google Oauth2 redirect_uri_mismatch

我将 Google OAuth2 用于我的 codeigniter 应用程序,并使用 HybridIgniter 发送请求。

重定向 URIS:http://localhost/college-rating-system/hauth/endpoint

JAVASCRIPT 来源:http://localhost

当从本地主机发送请求时,我们得到 400 错误,即,

错误:redirect_uri_mismatch

任何的想法 ..?

google-api oauth-2.0

6
推荐指数
1
解决办法
6815
查看次数

没有用户OAuth流程的YouTube API

我正在尝试使用YouTube Data API(v3)从YouTube视频中获取字幕 https://developers.google.com/youtube/v3/guides/implementation/captions

所以,首先我尝试使用此网址检索字幕列表:https://www.googleapis.com/youtube/v3/captions? part = snippet & videoId = KK9bwTlAvgo & key = {My API KEY}

我可以从上面的链接中检索我想要下载的标题ID(jEDP-pmNCIqoB8QGlXWQf4Rh3faalD_l).

然后,我按照此说明下载了标题:https: //developers.google.com/youtube/v3/docs/captions/download

但是,即使我正确输入了标题ID和我的api密钥,它也会显示"需要登录"错误.

我想我需要OAuth身份验证,但我想要做的是与用户的帐户无关,而只是自动下载公共字幕数据.

我的问题是:有没有办法只处理OAuth身份验证一次,以获取我自己的YouTube帐户的访问令牌,然后在我的应用程序中需要时重复使用它?

python youtube oauth youtube-api caption

6
推荐指数
1
解决办法
2399
查看次数