2
關於使用Google OAuth庫的教程DartWatch blog。問題是如何處理:來自Google的「拒絕訪問」錯誤?google_oauth2_client如何處理「訪問被拒絕」
這裏是我的代碼示例:
class Client
{
GoogleOAuth2 _auth;
Client()
{
_auth = new GoogleOAuth2(
'5xxxxxxxxxxxxxx.apps.googleusercontent.com', // Client ID
['openid', 'email', 'profile'],
tokenLoaded:oauthReady);
}
void doLogin()
{
// _auth.logout();
// _auth.token = null;
try
{
_auth.login();
}
on AuthException {
print('Access denied');
}
on Exception catch(exp)
{
print('Exception $exp occurred');
}
}
void oauthReady(Token token)
{
print('Token is: $token');
}
}
,但我從不打catch
塊任何異常(!)。我做錯了什麼?
我使用:
飛鏢編輯器版本0.5.0_r21823
飛鏢SDK版本0.5.0.1_r21823
謝謝:)我忘了'_auth.Login()'是一個'Future' – Jasper 2013-04-25 06:55:57