st4lk / django-rest-social-auth

OAuth signin with django rest framework
MIT License
521 stars 122 forks source link

Not able to make request with Angular 8 #124

Open IsabelaLiberatoscioli opened 4 years ago

IsabelaLiberatoscioli commented 4 years ago

Hello, I am using Angular 8 with Django and I'm trying to retrieve JWT token using POST 'api/login/social/jwt-pair/', but I'm no able to accomplish this. If I make a request like this, using HttpClient:

this.http.post(
      'http://localhost:8000/api/login/social/jwt-pair/',
       {  provider : 'facebook', code:  'XXXXXXXXX' },
      {
        headers: new HttpHeaders()
        .set('Content-Type', 'application/x-www-form-urlencoded'),
      }
    );

All I receive is: Provider is not specified Bad Request: /api/login/social/jwt-pair/

Also tried:

this.http.post(
      'http://localhost:8000/api/login/social/jwt-pair/',
       JSON.stringify({  provider : 'facebook', code:  'XXXXXXXXX' }),
      {
        headers: new HttpHeaders()
         .set('Content-Type', 'application/json')
      }
    );

But all I receive is:

Not Found: /api/login/social/jwt-pair/

What am I doing wrong??? All my posts in my API work but this one doesn't. I even tried to have a middleware so I could format the request.data and it be accepted by post method, but it doesn't work either, I keep receiving the same messages. Even though my middleware is able to get the provider from request. I don't know what I am missing, can anyone help?

alexanderblackh commented 4 years ago

Did you ever find an answer to this? Having this issue as well with AppleID.