0
Sales Force를 내 앱에 통합하기 위해 ZKForce를 사용하고 있습니다. 지금까지는 성공했지만 지금은 새로 고침 토큰과 관련된 문제에 직면하고 있습니다.Sales Force가 ZKForce를 사용하여 새로 고침 토큰 가져 오기
신청서에서 영업 담당자에게 로그인 할 때 다음을 수행하고 있습니다.
- (void)loginResult:(ZKLoginResult *)result error:(NSError *)error
{
if (result && !error)
{
NSLog(@"session id is %@",result.sessionId);
[SFAccountManager sharedInstance].coordinator.credentials.accessToken = result.sessionId;
NSLog(@"Login Successful");
}
else if (error)
{
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Connection failed" message:@"Failed connecting to server. Please try again" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[myAlertView show];
}
}
여기서는 액세스 토큰을 설정하고 새로 고침 토큰을 설정하지 않습니다.
나는 샘플의 경우 메모 응용 프로그램을 다운로드하고 그것을 다음에 성공적으로 로그가 있습니다. 여기가 새로 고침 토큰을 설정하는에서- (void)loginOAuth:(FDCOAuthViewController *)oAuthViewController error:(NSError *)error
{
if ([oAuthViewController accessToken] && !error)
{
NSLog(@"Logged in to Salesforce");
[[FDCServerSwitchboard switchboard] setClientId:kSFOAuthConsumerKey];
[[FDCServerSwitchboard switchboard] setApiUrlFromOAuthInstanceUrl:[oAuthViewController instanceUrl]];
[[FDCServerSwitchboard switchboard] setSessionId:[oAuthViewController accessToken]];
[[FDCServerSwitchboard switchboard] setOAuthRefreshToken:[oAuthViewController refreshToken]];
NSLog(@"oauth token is %@",[oAuthViewController accessToken]);
NSLog(@"oauth token is %@",[oAuthViewController refreshToken]);
[self.splitViewController dismissModalViewControllerAnimated:YES];
[self.oAuthViewController autorelease];
// STEP 3 b - Save OAuth data after login
[self saveOAuthData: oAuthViewController];
[self didLogin];
}
else if (error)
{
[CaseMemoAppDelegate errorWithError:error];
}
}
.
내 코드에서 새로 고침 토큰을 얻으려면 어떻게해야합니까? 도와주세요. 감사합니다.
만료 여부를 확인하는 방법 ??? 내가 얻을 수있는 액세스 토큰에 로그인 할 때마다 동일합니다. 하지만 오랜 시간 동안 앱을 유휴 상태로 유지하고 데이터에 액세스하려고 시도하면 오류가 발생합니다. –