Forum General


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

OAuth User Unique Identifier

naiknaik USMember ✭✭

I am trying to figure out if there is a way to get a unique identifier for a user of my app that uses OAuth to sign in through an identity service provider like Google, Facebook, Twitter, or Microsoft. I have realized that getting a unique identifier through the device info is not unique if the app is uninstalled and reinstalled.

My cross-platform app needs a unique identifier of the user so that I can take that value, convert it through Convert.ToBase64String, and store that value as the name of a text file in an Azure Storage Blob. The user can then have app settings saved (which is of no security concern, the settings being saved are of no value to anyone else) to the cloud storage by uploading the settings as values in string format stored in the text file in the Azure Storage Blob. It must be able to send newly modified settings to the same text file by file name. It identifies the correct file by of course using the unique identifier that was converted to base64. I know you're going to say to use a Database to store settings but I cannot afford the price of an online database server at this moment because it would mean implementing a web service to use SQL server and I have no experience in setting one up for Xamarin at the moment. And even if I were to use an online database, my question still stands as I can still store the unique identifier online but I need the identifier to be unique to each app user.

It is imperative that the unique identifier given by OAuth never changes so that the user can still access the text file stored in the cloud because the app knows the correct file name since the user's OAuth unique identifier never changes. Being able to store settings are a "premium" feature for the user, so they pay money to have this feature in my app. The only way I can give a premium user access to storing settings in the cloud is if I can store it in a uniquely named file (or table row in a database).

Now I am just wondering if there is such an identifier for OAuth users of my app.

I know that you can pull the email address of a user from an identity service provider such as Facebook but I have read that sometimes users elect not to have an email stored in their account at Facebook or Twitter and therefore my app can't pull a unique identifier for them if I use the email address. I was hoping maybe OAuth somehow creates a unique identifier but I am suspecting this is not the case.

If there is no solution using OAuth, are there any workarounds or alternatives that would work with Xamarin (especially Xamarin Forms)? I am looking to not spend money if I have to because I am just starting out as a programmer.

I was thinking that my use case doesn't need anything too complicated since the only thing I require is that the user be able to login and then save some very simple settings in the cloud. A typical user would probably have about 30-50 settings which is equivalent to probably a maximum of 30kb storage :smile:

Sign In or Register to comment.