function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John T.John T. 

logout from Oauth

Hi Guys,

 

When I try to logout from my IOS app it redirects me to the OAUTH screen which asks permission. I wanted to return to the login screen of Oauth. Is there a way I can do that?

joshbirkjoshbirk

It sounds like the WebView is remember the user's session.  You might try redirecting the view to logout.jsp first, which I think should clear out the related cookies.

SoleesSolees

try this   

 

 [[[SFRestAPIsharedInstance] coordinator] revokeAuthentication];

    [[[SFRestAPIsharedInstance] coordinator] authenticate];


Dhiru47Dhiru47
Hi i have tried your suggestion , it doesnt pop out the login screen

2013-09-27 11:12:00.301 CareWeb[21446:c07] oauthCoordinator:didBeginAuthenticationWithView
2013-09-27 11:12:00.302 CareWeb[21446:c07] Warning: Attempt to present <SFAuthorizingViewController: 0x8451c50> on <SFNativeRootViewController: 0x82315b0> whose view is not in the window hierarchy!
SoleesSolees

This solution was working with the 1.2 or less of the mobile sdk.  If you are using a new one, try posting the question to the github page where they can help you.

 

cheers

Dhiru47Dhiru47
This is a old project which has to be modified , in settings its says version 1.0.0 ... Any help?
SoleesSolees

https://github.com/forcedotcom/SalesforceMobileSDK-iOS try posting there your question, never the less they might tell you to upgrade to 2.0 , but give it a try.

 

On the other hand i used that code in one of my project using 1.1 and 1.2 , but it was just for testing.  I usually tell the users to go to Settings-> Images for Salesforce-> Logout- ON.

Dhiru47Dhiru47
Thats true ,
But i have instantiated the storyboard from app delegate once the user does the authentication using following method

- (UIViewController*)newRootViewController {


[self addDeviceTokenToChatter];
[self getTheUcsfUserId];

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

UINavigationController * myStoryBoardInitialViewController = [sb instantiateInitialViewController];
return myStoryBoardInitialViewController;

}


Now i have tried logging out using the following function

-(void)logoutofTheApp
{
[[[SFRestAPI sharedInstance] coordinator] revokeAuthentication];
[[[SFRestAPI sharedInstance] coordinator] authenticate];
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs://"]];

}

i get this message
"view is not in the window hierarchy! "