How to Force Logout?

On the different OS's, what do I call to force a logout from code? Is there a common cross-platform operation available in the Xamarin libraries?

Tagged:

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    'Log out' of what? Log out of your company server? Log out of Facebook?

  • alaskanroguealaskanrogue USMember ✭✭✭

    Log off the device, i.e. pc, tablet... This is assuming the access the device a log on process was implemented.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I'm not sure what you're talking about. You don't log into an iPhone, iPad or even my Samsung tablets.
    The devices don't have logins. There is no username/password kind of thing that takes place on these devices. At least not by default.
    Do you mean 'lock' and 'unlock'?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @alaskanrogue said:
    Log off the device, i.e. pc, tablet... This is assuming the access the device a log on process was implemented.

    It's not very clear... if you have a Login Page, to "Logout" you can visualize again the "Login" page...

  • alaskanroguealaskanrogue USMember ✭✭✭
    edited November 2017

    I understand that some OS's on devices can "not have" a log on/off implementation or have that implementation not enabled if present. But in the case that it is present and enabled, is there a programmable way to force a log off from an installed application?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think it's not a OS problem but an App problem. It depends how do you implement Login protocol.
    If you do a Login connecting with a REST service to a server, the Logout should connect to a REST service ...
    If you do a Login with Facebook, the logout (I think) should disconnect from Facebook.
    If your Login set a bit to 1 in your Application.Properties, your Logout should set the same bit to 0

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I think @alaskanrogue really is talking about logging in and out of Windows Desktop as a user to the device. Or MacOS on a desktop. Not an API like Facebook.

    @alaskanrogue You need to look up how that is done on each device and impliment it as you would on that native device. Probably in a DependencyService since that is where platform-specific code lives.

    Mind you - if you do that, don't expect the app to be approved by the various app stores. If you're just making an in-house app for a company and will be doing private distribution on company-owned hardware its one thing. But you can't expect people to accept your app just logging them out of their PC because it felt like it. That borders on malware.

  • alaskanroguealaskanrogue USMember ✭✭✭

    Taking a different approach then for non-phone devices but not Windows desktops, i.e. iPad or Android tablets, where log on/off is not enabled (third party extension), is there an approach to force an app on startup to load before the desktop appears and then give that app the ability to force shutdown potentially before the desktop appears?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    No. And again you're going to get rejected by the app stores.

    Again - you don't log into an iPad. Or log into an Android tablet. There is no "log in" to the OS on those platforms/devices.

    It sounds like you're trying to make an app that will be more like an 'embedded device' kind of take over. The tablet is going to be a corporate device and only use one program as if that is the sole purpose in life for the tablet.

    If you want that kind of grown-up enterprise-grade feature you're going to have to look outside of the app itself and use grown-up enterprise tools, like Samsung Knox to gain greater control over the tablet at a really low level.

    As a mid-way point on Android, you can designate your app to be the launcher. In effect it becomes the desktop app. So when the tablet boots it launches your app as the launcher. There are still a dozen ways out of that. But its a starting point for the behavior you describe; at least enough to get your proof-of-concept program green-lit by the people writing the checks, for further development and paying for the true tools you'll need to do it right.

  • alaskanroguealaskanrogue USMember ✭✭✭
    edited December 2017

    Clint, you're right, I am not expecting this to be app store distributed, but expect someone, not the common user, to install it.

    I realize that for some devices that there is no "log in", just start up. I just need the app to do some activity before the desktop becomes enabled. Depending on the activity results, the startup either continues to the desktop or forces a reboot before the desktop appears.

    I am not trying to create a "one program" that is the sole purpose. I am not trying to create a "launcher"

    Your suggestion of using "Samsung Knox" for Samsung devices was useful as it shows that there are possible API calls in Android to accomplish what I am attempting to do. Is that API public? Is there a similar API for iOS and MacOS?

    If not public, do I need to work directly with Google and Apple?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I just need the app to do some activity before the desktop becomes enabled.
    I am not trying to create a "one program" that is the sole purpose. I am not trying to create a "launcher"

    Well... You could make your setup app the 'Launcher'. Then when its done, it launches the real launcher to be used with the tablet.

    Is that API public?

    Nope

    Is there a similar API for iOS and MacOS?

    Nope.

    Maybe a better approach is to see if you really need to go down this road.
    It needs to do things before the actual desktop comes up? Really? Like what?

  • alaskanroguealaskanrogue USMember ✭✭✭

    Verify authorization of use of the device.

Sign In or Register to comment.