A
A
Alexey2015-12-15 18:32:27
PHP
Alexey, 2015-12-15 18:32:27

How to determine the provider when authorizing through social networks?

I made authorization through social networks (Vkontakte for example):
If you want to log in through VK, the user clicks on a link like this:

http://oauth.vk.com/authorize?client_id=3333333&redirect_uri=http://mysite/index.php?do=auth_social&provider=vk&response_type=code

And everything seems to be fine, authorization works, but I get this in response:
http://mysite/index.php?do=auth_social&code=1428c3455fg4c9cc9ab

those. is not returned to me $_GET['provider'] == 'vk', so I cannot determine through which social network the user logged in.
Or is it done in some other way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2015-12-15
@dzheka3d

Try like this:
You are trying to pass url to urle.
For url arguments in php use php.net/manual/ru/function.urlencode.php

M
Michael, 2015-12-15
@scherbuk

in your case, I see an option, just check the href attribute with js and send the post to the server with Ajax,
but in general, I would do this: I would
force users to click on links like
/auth/provider/vkontakte
...
And there already Location: oauth.vk. co ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question