2016-05-07 70 views
0

一旦以前的刷新/訪問令牌失效,我無法獲得新的刷新/訪問令牌,有沒有辦法使用sdk來做到這一點,因爲現在我必須去https://box-token-generator.herokuapp.com/來重新創建刷新/訪問令牌。這是代碼示例Box'SessionAuthenticated'event not fire

 var boxConfig = new BoxConfig(clientId, clientSecret, uriRedirect); 
     OAuthSession oAuthSession = new OAuthSession(accessToken, refreshToken, expiresIn, tokenType); 
     BoxClient boxClient = new BoxClient(boxConfig); 
     boxClient.Auth.SessionAuthenticated += Auth_SessionAuthenticated; 
     boxClient.Auth.SessionInvalidated += Auth_SessionInvalidated; 

     boxClient = new BoxClient(boxConfig, oAuthSession); 

回答

0

請使用以下

1>

client.Auth.SessionAuthenticated += new EventHandler <SessionAuthenticatedEventArgs> (Auth_SessionAuthenticated); 

2: 同時請加以下方法

void Auth_SessionAuthenticated(object sender, SessionAuthenticatedEventArgs e) 
{ 
    string boxAccessToken = e.Session.AccessToken; 
    string boxRefreshToken = e.Session.RefreshToken; 
}