node.js - Node/Express API - decouple oAuth login from server -


i have developed rest api using node.js , express , client application using angular.

i authenticate users using third party oauth services (twitter initially), of tutorials/reading have done suggests must have webapp coupled server avoid security exceptions due different domains.

i wish keep server , client decoupled plan build native apps @ point in future.

can advise on workflow required such setup? surprised if server , app must coupled given native apps have decoupled setup.

looking advice, thoughts, links ;)

for getting access token in order fetch information of user advised make request server (you can securely store clientid , secret there).

  1. you have endpoint can authorize client specific service, let's /oauth/twitter/authenticate. call endpoint clicking login twitter button of angular application
  2. you have endpoint twitter going return information, in success or failure, e.g. /oauth/twitter/callback. store information in success , potentialy establish user session. perhaps have endpoint checking if user has active user session.

there node module make life easier , incredibly easy use express middleware, passport , has twitter authentication strategy.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -