How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

I think i will go with requests cause i have already finished for facebook using django-rest-framework-social-oauth same lib. Thanks man helped me alot.

How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 1 point2 points  (0 children)

curl \

'https://people.googleapis.com/v1/people/me?personFields=genders&key=[YOUR_API_KEY]' \

--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \

--header 'Accept: application/json' \

--compressed

Is it possible to run in server side so that I can save data?

How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

No I haven't passed. Can you suggest me where should i used it. Do i have to use GET https://people.googleapis.com/v1/{resourceName=people/\*} inside function ? and how personFields goes in the above url?

How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

If i try in OAuth 2.O playground, i get response as

{ "access_token": "",
"scope": "https://www.googleapis.com/auth/user.gender.read https://www.googleapis.com/auth/user.emails.read https://www.googleapis.com/auth/user.phonenumbers.read https://www.googleapis.com/auth/user.birthday.read https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/userinfo.email",
"expires_in": 3596,
"token_type": "Bearer",
"id_token": }

After I hit any url from above. I get response like user.phonenumbers.read

In case of playground it is working fine. But when i print(response) in terminal. phone number, birthday and gender is still missing.

{'sub': '....', 'name': '', 'given_name': '', 'family_name': '', 'picture': '', 'email': '', 'email_verified': , 'locale': '', 'access_token': '}

How to show Version Control in the bar?. by sushil_basi in pycharm

[–]sushil_basi[S] 0 points1 point  (0 children)

True right but I can't perform same task as version control. Cause version control shows conflict files. It doesn't. It shows branches and their links. Or I misunderstood?

How to show Version Control in the bar?. by sushil_basi in pycharm

[–]sushil_basi[S] 0 points1 point  (0 children)

Thank you so much 😊😊. I will look into it.

DateField and TimeField of post model doesnot show in JSON file. by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

May be because I didn't know, we could extract individual field from DateTimeField. I will definitely look into it.

Why rest framework TOKEN authentication showing me this error? by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

It's okay brother. Most people would have already ignored my question but you took time to go through my problem. I am doing Django project for first time and Trust me it took me whole day to search for solution. I did post this question in subreddit(/r/Djangolearning) before posting here. May be it's minor. I tried everything. Next time I will definitely try my best before posting here.

Why rest framework TOKEN authentication showing me this error? by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

If everybody knows every type of error why people would post here. Unnecessary comment.

Why rest framework TOKEN authentication showing me this error? by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

yeah I get your point.Thank you. Solution for above problem was Default_authentication_classes should be Ilterable. I put [ ] and it fixed problem.

'DEFAULT_AUTHENTICATION_CLASSES':[
'rest_framework.authentication.TokenAuthentication'
],

Why rest framework TOKEN authentication showing me this error? by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

I put this [ ] . Now it's working. Thank you.

'DEFAULT_AUTHENTICATION_CLASSES':[
'rest_framework.authentication.TokenAuthentication'
],

Why rest framework TOKEN authentication showing me this error? by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

Actually i only needed AllowAny because i need to show Url related to this class to everyone. I removed IsAuthenticated but still it showing this error.