小编Iro*_*ide的帖子

使用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
查看次数

使用 WPF 网络浏览器时出现奇怪的字符,以及带有斜体标记和阿拉伯文本的 HTML

我无法弄清楚这个,但我在下面做了一个简单的演示。在 IE 或 Edge 中查看此页面时,它会正确呈现。我尝试过不同的编码,如 utf-16、Windows-1252,但没有奏效。对我来说,这似乎是 WebBrowser 控件的问题。有人能弄清楚吗?

阿拉伯语页面.html

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <p><i>???????</i></p>
    <p>???????</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

布局测试.xaml

<Page x:Class="WpfApp1.LayoutTest"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:WpfApp1"
    mc:Ignorable="d"
    Background="Yellow"
    d:DesignHeight="450" d:DesignWidth="800"
    Loaded="Page_Loaded"
    Title="LayoutTest">
    <WebBrowser x:Name="MyWebBrowser" Margin="20,5,0,5"/>
</Page>
Run Code Online (Sandbox Code Playgroud)

LayoutTest.xaml.cs

using System;
using System.Text;
using System.Windows;
using System.IO;
using System.Windows.Controls;
namespace WpfApp1
{
    public partial class LayoutTest : Page
    {
        public LayoutTest()
        {
            InitializeComponent();
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            string dirPath = AppDomain.CurrentDomain.BaseDi?rectory;
            string fileName …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf localization internationalization

3
推荐指数
1
解决办法
361
查看次数