Auto log out from devices - ionic-framework

I have a RestAPI which will hit to authenticate the user. This api is to android they hit this api to allow user to login to our app
My requirement is this.1) If user has cell phone say xyz phone with IMEI "xyzz1234". Now if he tries to log in from his 2nd phone than he should not be allowed to login from 2nd phone. He should log out automatically from abc device.
As i am using ionicv1 framework for mobile applications.

You can update the deviceID in your database once the user Sign in on another device.
In your signIN API, validate your deviceID.
For the case of login state saved in your app, you can hit an API at your dashboard on startup which can make the person logout.
This could be one possible approach :)

Related

Login authentication like Netflix multiple users for same account in flutter

I'm creating an trading app in flutter
Imagine that if an user account has an multiple login from different mobile devices if any one the user can change the account password how can I logout from all other user of different device
Or plz instruct me to create an logine authentication like instagram if an user logged in from another device change a password it will automatically logout from other device
The way I see this is that Firebase doesn't allow you to implement this functionality right now so you'll have to get creative with this by :
Keep track of all the devices through name or IMEI from which logins of a particular user is happening
Create a boolean isSignedOutAll for each and every user and check for this at startup
Turn this to true if a user is clicking on Sign Out Of All Devices option
Logout the user if isSignedOutAll is true on a particular device and then change it back to false for that particular device
This is the solution that I can think of now.

is there a way to check if user is currently "signed in with apple" in flutter app?

I have a flutter app with 2 authentication methods:
Based on device id (associated with account during account creation)
Sign in with apple
I need to know whether user is currently signed in with apple on each app launch.
Why I need that:
When device id is not found in my back end, I send user to registration page, where user has 2 options to register:
regular registration
sign in with apple
The problem is that device id can be changed on ios upgrade, app reinstall etc. Therefore if user signed in with apple first time, but then his device id has changed, I want to remove sign in with apple button. Because for that particular case user is supposed to go through regular sign in method where he needs to enter phone number he entered during the registration and if he confirms SMS code, then account is linked to new device id and access is restored. I don't want them to click sign in with apple again, because during regular sign ins I only get tokens from apple and can't get apple id email anymore.
Hopefully that makes sense.
Thank you

Keycloak Device Tokens Support?

I read this question that was asked since 2014-2016. Right now is still not support?
https://lists.jboss.org/pipermail/keycloak-user/2016-February/004821.html
http://lists.jboss.org/pipermail/keycloak-dev/2014-January/001116.html
From link above. Here's my thoughts on device mgmt, both UI and protocol:
Scenario:
An iOS device as a "Brokerage App" installed. The app needs to do REST
invocations to be able to trade stocks, etc. Devices must be registered
in order to obtain permission. Flow would look like this:
User installs app on iPad.
User hits login button on app.
User is redirected to browser with a Keycloak server URL
User enters in credentials
User is redirected to "Device Registration" page. Keycloak asks user
if it authorizes access to the device.
Keycloak registers the device under the user and generates a device token
User is redirected back to iPad ap
iPad app gets auth code from redirect URL
iPad makes REST request to obtain auth token AND a device token.
iPad app stores the device token.
Thanks

How to notify app that user has changed in facebook app/ Safari IOS

Using Facebook SDK 3.5.1 in my app, my requirement is that i have logged in the app via facebook with one user (say user A) and now if i login with other user (say user B) in mobile safari/facebook app (which one is available), in this case can my app get notified that another user logged in other than one who was logged in app.
Any references or ideas?
Thanks in advance
Note : I know that this Question was asked before but no answer is there :(
I don't think there is an option for this in the Facebook API. At least I couldn't find it.
Facebook SDK for iOS
What you can do, however, is simply check every minute or so who is available.
You can save this data in an array and then compare it a minute later with the new data.
Here is how you can fetch a list of your connected friends:
iOS Facebook SDK - get list of Friends connected with App

Connecting to Twitter using xAuth on iPhone and/or OAuth on Web?

I am building a Web site and iPhone app right now. My site and app requires registration.
I have received xAuth permission from Twitter and was going to use this for the iPhone app so that users can connect their Twitter account.
Once they connect their Twitter account, if they log in to the Web, is it possible to make it so their account is still connected?
On the other hand, I am using OAuth verification on the Web. If someone connects their Twitter account on the Web using OAuth, will they still be connected if logging onto the iPhone app?
So basically, I need to make:
User connects account on iPhone app (xAuth) -> User logs in to Web site and is still connected and can post to Twitter from both
User connects on Web (OAuth) -> User logs in to iPhone app and is still connected and can post to Twitter from both
You can do this --- basically once you do the OAuth based login it generate unique Token, so after this data reading is done using Token.
Once you get Token (it can be in Phone/web) use this details between each other so that both of your application can do the rest of operation for the same user without further login.