S
S
SrJ2015-09-15 11:20:59
OAuth
SrJ, 2015-09-15 11:20:59

OAuth in 1C via WinHttp.WinHttpRequest.5.1. How to get URL after redirect?

Colleagues, I am engaged in such a ... task.
You need to get an oAuth token from 1C and communicate with the Bitrix24 REST API...
First, you need to get a code. According to the Bitrix documentation, you need to send the following request:

https://XXXXX.bitrix24.ua/oauth/authorize/?client_id=ID_ПРИЛОЖЕНИЯ&response_type=code&http%3A%2F%2FXXXXXXX.XXX

Then the server should redirect us to the URL
http://XXXXXXX.XXX/?code=grprqfh71ogzfa5qb50b2rvwizickqn7&domain=XXXXX.bitrix24.ua&member_id=616c5rb77c856732c8c605eafac8d155

where code=grprqfh71ogzfa5qb50b2rvwizickqn7 is what I need...
If you do it using a browser, then everything is ok..
But I need to do it in 1C, and on the server-side.
Usually, POST requests in this case are sent via WinHttp.WinHttpRequest.5.1 connected as a COM object.
Actually, a question. I send a request, wait for execution and access the URL field of this object. What I see there is not at all what I saw in the URL field of the browser after the redirect.. I tried to access the "Location" header, but there is no such header..
How to get the current URL after the redirect?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question