G
G
ganjo8882019-04-20 17:54:22
PHP
ganjo888, 2019-04-20 17:54:22

How to fix Json rpc authorization error?

I am writing a Json rpc api to register users in the authorization system.
I send a Post request to this address test.ru/api/jsonrpc and enter a token for authorization, it all works.
But at the input of my request, one of my methods refers to this address to add users to the system auth.test.ru/api/v1/user
And I get this
Client error: `POST http://auth.test.ru/api /v1/user` resulted in a `401 Unauthorized` response:\nUnauthenticated\n"
How can I add additional authorization in Postman?
I tried inserting cookies, but it doesn't work
5cbb34b93c1e9622561419.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Kuznetsov, 2019-04-21
@ganjo888

one of my methods calls this address to add users to the system

And you pass your token there, what do you pass when you access test.ru/api/jsonrpc?
Apparently, you do not transfer.
Before calling the second one, you need to take this token from the request headers and pass it on, and so on for all methods that require authorization.

I
Immortal_pony, 2019-04-21
@Immortal_pony

jsonrpc is a transport independent protocol. Why are you trying to attach cookie authorization to it, which is only possible when using the http protocol? The token must be passed explicitly in the request body.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question