I have an API and a Web app working with Rails and Devise gem for authentication.
With Devise and Omniauth I can make the Signup with facebook and Login with Facebook through the web site.
I have my API protected with token_authenticable and a TokensController, so when you want to interact with my API first you have to pass to the TokensController your username and password and it will give you a valid token, my problem is what happen when the user is sign up with facebook, Shall I pass to the TokensController the username and the facebook token to generate the token? are there some standard way to do this?
Thanks for the comments.
Thanks for the comments; After thinking which one would be the best option, Here is what I finally did:
Note: I separate the code in client and server side(API)
Client Side:
Server side:
Note: All the communication is done via HTTPS.