Skip Navigation LinksHome > View Post

Fetching a basic user profile in Mobile Services (Day 9)

When building an application that has users authenticate, you often want to augment that user data with some kind of profile. Perhaps a nickname or real name, or a location. We collect this in the doto sample, and we also use the technique I’m going to post about here today.

image

Above you can see the registration screen in doto, but this is how it appears when you open the app, because we prefill the data based on your Microsoft Account profile when you login. This is a nice gesture for the user, as most will accept the defaults but for those that want to represent themselves differently in your app – they can customize the name.

Today, I want to share some server code that can help you do the same based on your public Twitter and Facebook profiles if your user logs in via Twitter or Facebook. The idea behind the simple function fetchBasicProfile below, is that you can simply pass in the user object in your Mobile Service server script, and it will invoke your callback with a simple profile object that has common properties for both Facebook and Twitter (which has wildly different basic profile structures available). Here’s the code:

And that includes a test you can run using Mocha JS (see day 7 for more on this).

The properties returned in the basic profile are:

  • name – the full name of the user, e.g. Josh Twist
  • firstName – the first name, e.g. Josh (not available on Twitter)
  • lastName – the surname or family name, e.g. Twist (not available on Twitter)
  • userName – a username specific to the source, e.g. @joshtwist or joshtwist
  • smallImageUrl – a url to a small (~50x50) profile image
  • largeImageUrl – a bigger image (~200x200)
  • source – the source of the information, e.g. Facebook or Twitter
  • id – the id of the user in the source system, usually a large number

It’s super easy to use and you can just paste this function into any of your scripts that want to do this.

This was day 9 of the twelve days of ZUMO. Join us tomorrow for day 10.

 
Josh Post By Josh Twist
23:49
29 Dec 2012

» Next Post: Setting the auth token in the Mobile Services client and caching the user’s identity (Day 10)
« Previous Post: Generating your own ZUMO auth token (Day 8)

Comments:

Posted by Dell @ 18 Apr 2013 16:12
car insurance quotes vvtu auto insurance %-[[[ discount car insurance =PPP cialis jowoz cheap car insurance tgs buy viagra 3860 new jersey car insurance %-[[[

Posted by Kayleigh @ 23 Apr 2013 07:41
Precios baratos de Cialis vohw auto insurance quotes 3841 viagra without prescription jfwvzj cheapest auto insurance ahldq cialis 8))) online colleges :-]]] a auto insurance 8PP

Posted by hjztriu @ 26 Apr 2013 19:29
hjztriu

Posted by gkmieh http://uhesdd.com/ <a href="http://reuidi.com/ ">upqhbiib</a> [url=http://kvxcpk.com/]upqhbii @ 26 Apr 2013 22:14
gkmieh http://uhesdd.com/ <a href="http://reuidi.com/ ">upqhbiib</a> [url=http://kvxcpk.com/]upqhbiib[/url]

Posted by Nook @ 27 Apr 2013 20:00
genericviagra >:DD cheap car insurance >:[[ viagra 865690 car insurance :]]] online colleges 22711 discount cialis 39733

Posted by Johnelle @ 27 Apr 2013 20:00
auto insurance qtpt car insurance 30452 car insurance quotes 830733 auto insurance quotes 6716 car insureance :]] viagra >:-PPP

Posted by Tamber @ 27 Apr 2013 20:01
Cialis genérica 535654 cheap car insurance ote new york car insurance lhume free car insurance quotes reyqi cheap car insurance >:(( auto insurance quotes eflat auto insurance quotes 283264

Posted by qhguyb http://paydayloansusapwa.com/ pay day loan >:]] http://paydayloansaustraliapwa.com/ payday lo @ 28 Apr 2013 03:53
qhguyb http://paydayloansusapwa.com/ pay day loan >:]] http://paydayloansaustraliapwa.com/ payday loans australia 6569 http://paydayloansusapwa.ca/ cash advance online >:-[ http://paydayloansukpwa.co.uk/ payday loans online :-O

Posted by xbadcqgy http://paydayloansaustraliapwd.com/ payday loan rxNhGt http://paydayloansusapwd.com/ payday @ 01 May 2013 21:20
xbadcqgy http://paydayloansaustraliapwd.com/ payday loan rxNhGt http://paydayloansusapwd.com/ payday advance 7451 http://paydayloansukpwd.co.uk/ short term loan NcVPR http://paydayloansusapwd.ca/ payday loan Canada %-[[[

Posted by ijgamws http://paydayloansukpwe.co.uk/ payday loans :-O http://paydayloansaustraliapwe.com/ payday l @ 02 May 2013 23:16
ijgamws http://paydayloansukpwe.co.uk/ payday loans :-O http://paydayloansaustraliapwe.com/ payday loans gumys http://paydayloansusapwe.com/ payday loan :-O http://paydayloansusapwe.ca/ no fax pay day loans 8]]]

Posted by chan luu bracelet @ 04 May 2013 04:21
Yes, you can make a super-dressy evening http://www.chanluustore.net/ work while the sun's still shining! Simply add a button-down tunic and a few easygoing accessories and voila-instant weekend outfit.Longoria's collection contains mostly functional, reasonably neutral bags, but the place where http://www.coachoutletvogue.com/ gets interesting is the products she chooses - Eva seems to be as big a fan of http://www.usitccoachpurses.net/ as she is prada, and not a lot of celebs can say that they take such an egalitarian http://www.marcjacobssale.co.uk/ approach to their wardrobes http://www.marcjacobsbagsstore.com/ .

Posted by Margaretta @ 04 May 2013 04:21
auto insurance bmty car insurance in florida 384639 car insurance quotes 9750 car insurance quotes 01567 auto insurance quotes =D new york car insurance >:-))) discount viagra =DDD

Posted by qbnurlmt http://paydayloansusapwg.com/ payday advance 9398 http://paydayloansusapwg.ca/ cash advance @ 04 May 2013 22:32
qbnurlmt http://paydayloansusapwg.com/ payday advance 9398 http://paydayloansusapwg.ca/ cash advance loans =-] http://paydayloansukpwg.co.uk/ online payday :-O http://paydayloansaustraliapwg.com/ payday loans 0599

Posted by fgzibwag http://paydayloansusapwh.com/ pay day loan 8610 http://paydayloansusapwh.ca/ cash advance l @ 05 May 2013 20:54
fgzibwag http://paydayloansusapwh.com/ pay day loan 8610 http://paydayloansusapwh.ca/ cash advance loans 4925 http://paydayloansukpwh.co.uk/ payday cash 7832 http://paydayloansaustraliapwh.com/ payday loans australia 8897

Posted by ztopveol http://paydayloansaustraliapwi.com/ payday loans %-[[[ http://paydayloansusapwi.ca/ cash ad @ 06 May 2013 23:18
ztopveol http://paydayloansaustraliapwi.com/ payday loans %-[[[ http://paydayloansusapwi.ca/ cash advance online 4250 http://paydayloansusapwi.com/ pay day loan %-[[[ http://paydayloansukpwi.co.uk/ payday loans online >:-OOO

Posted by gfhsrmv http://paydayloansusapwj.com/ payday loan CmjgYq http://paydayloansusapwj.ca/ cash advances @ 08 May 2013 00:58
gfhsrmv http://paydayloansusapwj.com/ payday loan CmjgYq http://paydayloansusapwj.ca/ cash advances 8]]] http://paydayloansukpwj.co.uk/ payday cash 5362 http://paydayloansaustraliapwj.com/ payday loans FQkuuc

Posted by ooodod http://paydayloansusapwj.com/ fast payday loan eKVVL http://paydayloansaustraliapwj.com/ payd @ 08 May 2013 21:53
ooodod http://paydayloansusapwj.com/ fast payday loan eKVVL http://paydayloansaustraliapwj.com/ payday loans australia 9298 http://paydayloansusapwj.ca/ cash advance online kMbTev http://paydayloansukpwj.co.uk/ payday Advance uk 5791

Posted by Janet @ 09 May 2013 04:38
cialis 229427 auto insurance quotes :-( cheap auto insurance zkknj online colleges hqqoem car insureance 893042 cheap car insurance 8[

Posted by Veanna @ 09 May 2013 23:54
car insurance jqsoya viagra >:[ infinity auto insurance 925 Cialis ckzo cheap viagra shix

Posted by Celina @ 15 May 2013 12:49
where to buy prednisone =OO cialis :OO carinsurance ftjcgm colleges online 209493 online viagra :OOO

Posted by Lonitra @ 16 May 2013 20:06
prednisone 745891 viagra =] levitra %]] compare cialis levitra viagra 0253 online schools 27970

Posted by Maralynn @ 16 May 2013 20:06
buy viagra in usa :-OO viagra sale 184277 prednisone sci propecia 573 cialis :-P auto insurance zlurz online car insurance 1175

Posted by Loradae @ 16 May 2013 20:06
buy viagra 543 cialis for sale 4830 buy viagra 01880 where to buy levitra 785042 cheap auto insurance cmp

Post a comment:

Name  

E-mail (never shared)

URL

Comments  

Captcha ImageRefresh Image
What's this?
Enter code above

© 2005 - 2013 Josh Twist - All Rights Reserved.