Skip to navigation Skip to content
Simon Technology Blog
  • Architecture
  • Cloud
  • Database
  • Develop
  • Hardware
  • Industry
  • Language
  • Mobile
  • Opensource
  • OS
  • Web
Main Navigation

Google login problem on Xbox One C # GoogleWebauthorizationBroker.Authorizeasync

September 26, 2021By Simo Tablet

When running on a Windows 10 desktop/mobile device, this code works fine in my UWP application, but on Xbox One I receive an error:

My c# code:

credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new Uri("ms-appx:///Assets/client_secrets.json "),
new[] {"https://www.googleapis.com/auth/plus.profile.emails.read" },
"user",
CancellationToken.None) ;

return credential.Token.AccessToken;

Here are the steps that are happening:

>click on Google login btn
>Google login interface is now Loading
>I can log in to my Google account
>The login window asks me to authorize permissions for the application
>An error occurred here: I never got an Oauth token and received the following error message:< br>Error: “Success”, description: “WebAuthenticationBroker did not return a code or error. Details: 0”, Uri: “”

Does anyone have this problem?

My project.json file:

{
"dependencies": {
"Google.Apis": "1.15 .0",
"Google.Apis.Auth": "1.15.0",
"Google.Apis.Core": "1.15.0",
"Microsoft.ApplicationInsights": "2.1.0",
"Microsoft.ApplicationInsights.PersistenceChannel": "1.2.3",
"Microsoft.ApplicationInsights.WindowsApps": "1.1.1",
"Microsoft.NETCore .UniversalWindowsPlatform": "5.2.2",
"Microsoft.Xaml.Behaviors.Uwp.Managed": "1.1.0",
"MvvmLightLibs": "5.3.0",
"Newtonsoft.Json": "9.0.1",
"NotificationsExtensions.Win10": "14295.0.1"
},
"frameworks": {
"uap10.0 ": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Thoughts on what I did wrong?

Like Franklin proposed, I chose a good old WebAuthenticationBroker, if others Interested, here is a piece of code:

String GoogleURL = "https://accounts.google.com/o/oauth2/auth?client_id=" 
+ Uri.EscapeDataString("ABC-DECF1234.apps.googleusercontent.com")
+ "&redirect_uri=" + Uri.EscapeDataString("urn:ietf:wg:oauth:2.0:oob")
+ "&response_type=code&scope=" + Uri.EscapeDataString("https://www.googleapis.com/auth/plus.profile.emails.read");

Uri StartUri = new Uri( GoogleURL);
Uri EndUri = new Uri("https://accounts.google.com/o/oauth2/approval?");

WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions .UseTitle, StartUri, EndUri);

if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
{
return WebAuthenticationResult.ResponseData.ToString();
}

When running on a Windows 10 desktop/mobile device, this code works fine in my UWP app , But on Xbox One I receive an error:

My c# code:

credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new Uri("ms-appx:///Assets/client_secrets.json"),
new[] {"https://www.googleapis.com/auth/plus.profile.emails.read"} ,
"user",
CancellationToken.None);

return credential.Token.AccessToken;

Here are the steps that are happening:

>Click on Google to log in btn
>The Google login interface is loading
>I can log in to my Google account
>The login window asks me to authorize the permission of the application
>Happens here Error: I have never obtained an Oauth token and received the following error message:
Error: “Success”, Description: “WebAuthenticationBroker did not return a code or error. Details: 0”, Uri: “”

< p>Does anyone have this problem?

My project.json file:

{
"dependencies": {
"Google.Apis": "1.15 .0",
"Google.Apis.Auth": "1.15.0",
"Google.Apis.Core": "1.15.0",
"Microsoft.ApplicationInsights": "2.1.0",
"Microsoft.ApplicationInsights.PersistenceChannel": "1.2.3",
"Microsoft.ApplicationInsights.WindowsApps": "1.1.1",
"Microsoft.NETCore .UniversalWindowsPlatform": "5.2.2",
"Microsoft.Xaml.Behaviors.Uwp.Managed": "1.1.0",
"MvvmLightLibs": "5.3.0",
"Newtonsoft.Json": "9.0.1",
"NotificationsExtensions.Win10": "14295.0.1"
},
"frameworks": {
"uap10.0 ": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Thoughts on what I did wrong?

As Franklin proposed, I chose a good old WebAuthenticationBroker, if anyone else is interested, here is a piece of code:

< /p>

String GoogleURL = "https://accounts.google.com/o/oauth2/auth?client_id=" 
+ Uri.EscapeDataString("ABC-DECF1234. apps.googleusercontent.com")
+ "&redirect_uri=" + Uri.EscapeDataString("urn:ietf:wg:oauth:2.0:oob")
+ "&response_type=code&scope=" + Uri.EscapeDataString ("https://www.googleapis.com/auth/plus.profile.emails.read");

Uri StartUri = new Uri(GoogleURL);
Uri EndUri = new Uri ("https://accounts.google.com/o/oauth2/approval?");

WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.UseTitle, StartUri, EndUri);

if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
{
return WebAuthenticationResult.ResponseData.ToString();
}

AuthorizationAasync, C #, Google, GoogleBauthorizationBroker, GooglebauthorizationBroker.authorizeasync, login, Question, Xbox

Post navigation

“Terror Valley”: Virtual reality is the only reality
Popen problem cannot be used under CGI

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1562 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment Cancel reply

Your email address will not be published.

Recent Posts
  • Sencha-Touch-2 – Sencha Touch 2, Nested XML Analysis NodeValue
  • Add a separation line and format XML content
  • Is there a norm of simplified XML subsets?
  • Look at it when you write React
  • ReactJS – Present React Redux React-Router App to add the server to the Firebase hosted by the Firebase
Categories
  • Android
  • Apache
  • Apache Kafka
  • Asp
  • Auto-Test
  • Automated Build
  • Aws
  • Bitcoin
  • Browser
  • C & C++
  • C#
  • Centos
  • Cgi
  • Character
  • Cloud Service
  • Cocos2dx
  • Cordova
  • CSS
  • Data Structure
  • Delphi
  • Design Pattern
  • Dojo
  • Dubbo
  • ELK
  • Flex
  • football
  • Game
  • Hadoop
  • Hibernate
  • HTML
  • Hybrid
  • Intel
  • IOS
  • Ipad
  • iPhone
  • Java
  • Javascript
  • Jetty
  • JQuery
  • Jsp
  • Linux
  • Load Balance
  • Lua
  • Macbook
  • Macos
  • Mathematics
  • Micro Services
  • Monitoring
  • Motherboard
  • Mysql
  • Network Hardware
  • Network Marketing
  • Nginx
  • NodeJs
  • Nosql
  • Oracle
  • Os Theory
  • Performance
  • PHP
  • Postgresql
  • Power Designer
  • React
  • Redis
  • Regexp
  • Rom
  • Rss
  • Ruby
  • Search Engines
  • Shell Script
  • Silicon Valley
  • Silverlight
  • Software Design
  • Spring
  • Sql
  • Sqlite
  • Sqlserver
  • Storage
  • Storm
  • Surface
  • SVN
  • Swift
  • System Architecture
  • Tablet
  • Uncategorized
  • Unix
  • Visual Basic
  • Visual Studio
  • Web Crawler
  • WebService
  • Windows
  • Wireless
  • XML
  • ZooKeeper
Archives
  • October 2021
  • September 2021
  • August 2021
  • May 2021
  • April 2021
  • September 2020
  • September 2019
  • August 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
© Simon Technology Blog 2025 • ThemeCountry Powered by WordPress