RealmTeam / django-rest-framework-social-oauth2

python-social-auth and oauth2 support for django-rest-framework
MIT License
1.06k stars 191 forks source link

Having trouble with redirect_uri #175

Closed alrhalford closed 5 years ago

alrhalford commented 5 years ago

Hi, I'm having a bit of trouble, and I would appreciate some help

I'm following the instructions to set up LinkedIn (in place of Facebook). I've added the app, as it says in the instructions, but I don't understand what to do with the redirect URI, as the instructions state that it should be blank. I have a link on my website of the form:

https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=CLIEND_ID&redirect_uri= http%3A%2F%2Ffoo.com%2Ffrontend%2Flogin_redirect&scope=r_basicprofile When I click this, linkedin confirms the request and then redirects to the link encoded in the url above (http://foo.com/frontend/login_redirect) with some parameters in the url. I should then send those parameters to a particular linkedin api endpoint to obtain a token for the user.

Currently, when linkedin tries to redirect, a 404 error is returned. I tried adding that redirect URI to the redirect URIs of the application, and the result was the same.

To summarise, do I need to use a particular redirect url (in which case, what is it?), or, if not, how do I tell django-rest-framework-social-oauth2 which redirect URI it should make available?

PhilipGarnero commented 5 years ago

The redirect URI would be and url on your front end. Your frontend extracts the code from the URI and can use my package to convert it.

alrhalford commented 5 years ago

Ah, I understand, I think. If I use authorized code based oauth2, does the redirect uri need to go into the django admin?