In building an a small Android app, I decided to try out Digits to login with a phone number and Parse for the back end.
How might I validate a Digits session with the Parse server?
I've started with the below example, though I'm not sure if this is 'correct' (adapted from this post).
Android Client:
Request auth (oauth?) token and user id from digits
a. Send in a digits key and secret, retrieve an object
Validate this session with Parse
a. Send in phone number, auth token, and user id
b. Receive acknowledge with user info if authorization is valid
Parse:
Auth endpoint takes phone number, auth token, and user id
a. Validate with twitter endpoint
b. Insert auth token hash and user id into a Sessions table (future requests will ping this table, not twitter)
c. Return acknowledge to client
The above makes sense, but a Parse Example with Github login seems to do something slightly different. With Parse, the initial request to the third-party is made from the Parse server, not the client.
Github requires a 'state' parameter to be sent in, which seems to be why the Parse example has its initial request sent from the server, whereas Digits does not require such parameter. Does this make the Digits authentication any less secure? Is there a way to make this process more secure/correct?