错误域=MCOErrorDomain 代码=5 "Unable to authenticate with the current session's credentials."
Error Domain=MCOErrorDomain Code=5 "Unable to authenticate with the current session's credentials."
我在为 imapSession
调用 checkAccountOperation
方法时遇到此错误
Error Domain=MCOErrorDomain Code=5 "Unable to authenticate with the current session's credentials." UserInfo={NSLocalizedDescription=Unable to authenticate with the current session's credentials.}
这是我的代码:
MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
session.dispatchQueue = self.imapQueue;
session.hostname = @"imap.gmail.com";
session.port = 993;
session.maximumConnections = 2;
session.username = emailAddress; //email address with which I logged in
session.password = nil;
session.OAuth2Token = accessToken; // access Token got in success response of google sign in
session.authType = MCOAuthTypeXOAuth2;
session.connectionType = MCOConnectionTypeTLS;
dispatch_async(self.imapQueue, ^{
MCOIMAPOperation *imapCheckOp = [session checkAccountOperation];
[imapCheckOp start:^(NSError *errorResults)
{
NSLog(@"%@",errorResults);
}];
});
我正在使用google登录SDK登录google账户
self.googleSignIn = [GIDSignIn sharedInstance];
self.googleSignIn.delegate = self;
self.googleSignIn.uiDelegate = self;
NSString *path = [[NSBundle mainBundle] pathForResource: @"GoogleService-Info" ofType: @"plist"];
NSMutableDictionary *googleDictplist =[[NSMutableDictionary alloc] initWithContentsOfFile:path];
NSString *googleClientId = [NSString stringWithFormat:@"%@",[googleDictplist objectForKey:@"CLIENT_ID"]];
self.googleSignIn.clientID = googleClientId;
[self.googleSignIn signIn];
对于同一问题,我已经尝试了从网上获得的几乎所有可能的解决方案。我在 Google 开发者控制台下为我的项目启用了所有需要的 API。即使我在创建 imapSession 时提供了密码,这个问题仍然存在。在我将登录更新为使用最新 google 登录 SDK 的方式后开始面临这个问题。
您还没有为 google 登录实例提供任何范围。尝试为相同的
添加范围
self.googleSignIn.scopes = [NSArray arrayWithObjects:@"https://www.googleapis.com/auth/userinfo.profile" ,@"https://www.googleapis.com/auth/userinfo.email", @"https://mail.google.com",@"https://www.google.com/m8/feeds/", nil];
我在为 imapSession
调用checkAccountOperation
方法时遇到此错误
Error Domain=MCOErrorDomain Code=5 "Unable to authenticate with the current session's credentials." UserInfo={NSLocalizedDescription=Unable to authenticate with the current session's credentials.}
这是我的代码:
MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
session.dispatchQueue = self.imapQueue;
session.hostname = @"imap.gmail.com";
session.port = 993;
session.maximumConnections = 2;
session.username = emailAddress; //email address with which I logged in
session.password = nil;
session.OAuth2Token = accessToken; // access Token got in success response of google sign in
session.authType = MCOAuthTypeXOAuth2;
session.connectionType = MCOConnectionTypeTLS;
dispatch_async(self.imapQueue, ^{
MCOIMAPOperation *imapCheckOp = [session checkAccountOperation];
[imapCheckOp start:^(NSError *errorResults)
{
NSLog(@"%@",errorResults);
}];
});
我正在使用google登录SDK登录google账户
self.googleSignIn = [GIDSignIn sharedInstance];
self.googleSignIn.delegate = self;
self.googleSignIn.uiDelegate = self;
NSString *path = [[NSBundle mainBundle] pathForResource: @"GoogleService-Info" ofType: @"plist"];
NSMutableDictionary *googleDictplist =[[NSMutableDictionary alloc] initWithContentsOfFile:path];
NSString *googleClientId = [NSString stringWithFormat:@"%@",[googleDictplist objectForKey:@"CLIENT_ID"]];
self.googleSignIn.clientID = googleClientId;
[self.googleSignIn signIn];
对于同一问题,我已经尝试了从网上获得的几乎所有可能的解决方案。我在 Google 开发者控制台下为我的项目启用了所有需要的 API。即使我在创建 imapSession 时提供了密码,这个问题仍然存在。在我将登录更新为使用最新 google 登录 SDK 的方式后开始面临这个问题。
您还没有为 google 登录实例提供任何范围。尝试为相同的
添加范围self.googleSignIn.scopes = [NSArray arrayWithObjects:@"https://www.googleapis.com/auth/userinfo.profile" ,@"https://www.googleapis.com/auth/userinfo.email", @"https://mail.google.com",@"https://www.google.com/m8/feeds/", nil];