I have been wanting to write about integrating Cozmo with Salesforce for a while and discussing Login Flows as part of the Authentication Series seems like the perfect opportunity.

A year ago, when I was still working for Salesforce, Alvaro Caso (an ex-colleague and friend) and I decided to participate in a 1- day hackathon activity organized for the engineering organization. For this hackathon we had the chance to work on anything that would solve an existing problem, come up with something that would improve a work-related process or ...simply have fun doing something nerdy, guess for which one we decided to go for?

Alvaro and I had bought a Cozmo robot each a while back and had been playing with them using the Python SDK, we had been toying with the idea of integrating it with our tools just for fun ... after a short brainstorming session we decided to leverage Cozmo’s face recognition abilities to enable two-factor authentication into our engineering org and somehow turn Cozmo into our assistant. Here is where login flows come in!

As per the documentation “You can use a login flows to customize the login experience and integrate business processes with Salesforce authentication. Common uses cases include collecting and updating user data at login, configuring two-factor authentication, or integrating third-party strong authentication methods.”

Considering our little robot can recognize not only objects but his owner’s face pretty much out-of-the box, it was just a matter of making this available as a service to the internet so that a login-flow-initiated call would start the two-factor flow authentication.

With the above in mind we decided to throw in the following components: A visualforce page to initiate the web service call, a Heroku-based microservice that would  receive the call and initiate authentication requests to Cozmo,  Cozmo himself and a little bit of Python code in the SDK to make Cozmo listen for authentication requests using a polling pattern. Below is a more detailed explanation.

loginfacebook-1

Unfortunately, Anki, the company behind Cozmo has shutdown earlier this year, however, given the low cost and online availability I’d still encourage Python/Robot enthusiasts to get your hands on a Cozmo if you can. I bought it for myself and my son but I ended up playing with him more than him ...yes, this was one of those presents... regardless, kids love Cozmo and it can be used to teach kids programming beyond Scratch.

Finally, what’s the point of all this explanation without a demo? Enjoy!