MacOS Xamarin - Google OAuth 回调在调试中工作,而不是在发布中
MacOS Xamarin - Google OAuth Callback working in debug and not in release
我在用 c#/Xamarin 编写的 MacOS 应用程序中的 OAuth 进程回调中遇到错误。
我使用 Clancey.SimpleAuth 来简化流程 (https://github.com/Clancey/SimpleAuth)
基本上在我的代码中,我有一个简单的 Auth,例如:
var scopes = new[]
{
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
};
var api = new GoogleApi("google",
"clientid",
"clientsecret")
{
Scopes = scopes,
};
var account = await api.Authenticate();
问题很简单:
当我在调试时一切正常,库接受回调,使用秘密挑战等。
当我在 Release 时,我收到这个错误:
2018-02-06 22:48:38.278 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
2018-02-06 22:48:38.279 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
2018-02-06 22:48:38.279 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
2018-02-06 22:48:38.279 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
DEBUG 和 Release Config 之间的问题/区别是什么?
提前致谢
无法用旧的 "component"
修复它
我切换回 "Official Google" 包:
var credential = await Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.AuthorizeAsync(
new Google.Apis.Auth.OAuth2.ClientSecrets
{
ClientId = "IDIDIDIDIDIDgesmfcm.apps.googleusercontent.com",
ClientSecret = "csL-.........."
},
new[] { "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile" },
"user",
CancellationToken.None, new FileDataStore("AppStore"));
Utils.Log("Logged as " + credential.UserId);
//TOKEN USE
我在用 c#/Xamarin 编写的 MacOS 应用程序中的 OAuth 进程回调中遇到错误。
我使用 Clancey.SimpleAuth 来简化流程 (https://github.com/Clancey/SimpleAuth)
基本上在我的代码中,我有一个简单的 Auth,例如:
var scopes = new[]
{
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
};
var api = new GoogleApi("google",
"clientid",
"clientsecret")
{
Scopes = scopes,
};
var account = await api.Authenticate();
问题很简单: 当我在调试时一切正常,库接受回调,使用秘密挑战等。
当我在 Release 时,我收到这个错误:
2018-02-06 22:48:38.278 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
2018-02-06 22:48:38.279 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
2018-02-06 22:48:38.279 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
2018-02-06 22:48:38.279 MyAppName[2789:37686] -[SimpleAuth_Native_CallBackHelper UrlHandleEvent:event:replyEvent]: unrecognized selector sent to instance 0x604000c340a0
DEBUG 和 Release Config 之间的问题/区别是什么?
提前致谢
无法用旧的 "component"
修复它我切换回 "Official Google" 包:
var credential = await Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.AuthorizeAsync(
new Google.Apis.Auth.OAuth2.ClientSecrets
{
ClientId = "IDIDIDIDIDIDgesmfcm.apps.googleusercontent.com",
ClientSecret = "csL-.........."
},
new[] { "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile" },
"user",
CancellationToken.None, new FileDataStore("AppStore"));
Utils.Log("Logged as " + credential.UserId);
//TOKEN USE