A
A
andribas2014-12-04 11:42:58
Angular
andribas, 2014-12-04 11:42:58

What is the best way to make rest api middleware?

There is an application that runs on localhost and provides a rest api with oauth2 authorization (data backend)
I'm trying to make a middleware application and use this rest api (angular).

how can i execute requests from two users - 1 server-side privileged user (let's say for creating new users) and 2nd user - client-side angular authorized via tokens.

The problem is that you need to add additional logic to the data backend for some requests and make it middleware (without changing anything in the data backend) and so that these requests are executed server-side -> server-side.
example scenario:
1. user authorization via google
2. getting his name, email
3. creating a new user in the data backend with this data (the request is performed by a privileged user)
4. authorizing the created user in the data backend
5. further rest api requests to the data backend are performed from the created user through the middleware (for example, they are proxied in the middleware - for 1 superrequest 5 requests are sent to the middleware to the rest api data backend)

Tell me what to do in this case. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2014-12-04
@AMar4enko

How does your question relate to AngularJS?
What do you write middleware in? express?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question