So i am using DRF Social Oauth2 to implement social authentication in DRF.
While setting the settings.py
we need many things to do like adding some apps to installed apps etc.
We also need to set these two settings;
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'google_client_id'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'google_client_secret'
But as we create a google console app for android, it doesnot provide any secret but only client_Id.
What i did is i just removed SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'google_client_secret'
from the settings and my api still worked fine. It gave the response without any errors.
After that, i tried to remove SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'google_client_id'
also and still my api worked fine.
So i am now confused why we use them? Why is my app working fine even without client_id and secret?
This is how i send the request;
http://127.0.0.1:8000/social/auth/token
body of the request;
{
"grant_type": "password",
"username": "myusername",
"password": "mypassword",
"client_id": "client id created in my backend when creating a new application for the social login (different from google client id)",
"client_secret": "client secret created in my backend when creating a new application for the social login (different from google client secret)"
}
OUTPUT:
{
"access_token": "some_token",
"expires_in": 36000,
"token_type": "Bearer",
"scope": "read write",
"refresh_token": "some_other_token"
}
Another request to save a user;
http://127.0.0.1:8000/social/auth/convert_token
{
"token": "token recieved from frontend from google",
"backend": "google-oauth2",
"grant_type": "convert_token",
"client_id": "...",
"client_secret": "..."
}
OUTPUT is same as the first request and it also adds the details to the database.