S
S
Sergey2017-03-18 07:58:30
Yii
Sergey, 2017-03-18 07:58:30

How to change Content Type in Yii2 received during OAuth authentication?

Hello.
Implementing user authentication through Mail.ru ran into a problem.
The error falls out:
Unable to detect format for content parsing. Raw response:
Http-Code: 200
Server: nginx
Date: Sat, 18 Mar 2017 04:26:47 GMT
Content-Type: text/javascript; charset=utf-8
Content-Length: 2499
Connection: close
P3p: policyref="/w3c/p3p.xml", CP="NON CUR ADM DEV PSA PSD OUR IND UNI NAV INT STA"
The essence of the problem is clear, but how to solve it? How to change the resulting format for the parser?
to come back to the beginning

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2017-03-18
@Pendal

Everything turned out to be easier than ever.

$response->setFormat(\yii\web\Response::FORMAT_JSON);

Q
qlkvg, 2018-01-10
@napmen

Your session exists only within the get_html function and is emptied by the garbage collector at the end of its execution. Bring the session object into the global scope and work with it in all functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question