Google: OAUTH2 authentication with curl? - google-api

How do I obtain a Google OAUTH2 key using curl? In particular I'm interested in getting a key for blogger.com.
I can successfully retrieve data when logged into the Google API Explorer.
GET https://www.googleapis.com/blogger/v3/blogs/byurl?url=http%3A%2F%2Feastbay-rc.blogspot.com&key={YOUR_API_KEY}

Related

How google OAuth sends JWT?

I am trying to understand how google OAuth works. I have implemented this oauth tutorial from spring docs. Below is the screen shot of network traffic occurred when I selected my account from the list of accounts shown by the google.
Resource 1
Resource 2
Resource 3
I guess OAuth works on JWT, and once username and password is correct, it should return JWT. However, I am not able to find JWT returned by google in above network traffic. Am I understanding it wrong?
OAuth2 may use JWT but it is not a requirement even though I believe (not sure on that one) that it would be used between Spring-security and Google.
However the communication is between the server and Google so you would not get the token in the front-end. If you get a token in your front-end it would most probably one generated from your own back-end.

Where Can I Find the Google API Authentication URLs and Curl documentation?

I am having trouble identifying the documentation for authenticating the Google Drive API. I have the Client ID and Client Secret already, but don't know the current Curl format for getting the Code and Access Token. Anyone have a documentation link for where to get Google API Authentication URLs?

Is it possible to get google api access token by using any REST API Client

I am looking for tips or tutorial where I can fetch data from youtube data api.
By using only api key, I can use any rest api client in order to fetch many informations from https://www.googleapis.com/youtube/v3/channels.
And now, I would like to get auditDetails which needs authorization token https://developers.google.com/youtube/v3/docs/channels/list#auth.
[Edit]
By following the steps below (Using OAuth guides), I can now make request but I have an error 400 which is redirect_uri_mismatch:
The redirect URI in the request, http://localhost:9874, does not match the ones authorized for the OAuth client
In my console developer configuration, I set the redirect authorized url to http://localhost/authorize.php
So I do not understand why during the authentification, it uses http://localhost:9874

Spring security oauth2 login with google

I want to create a login with google option and give authorities to the user depending on the user info returned. I've successfully done what I want for login with github following this tutorial:
https://www.baeldung.com/spring-security-oauth-principal-authorities-extractor
which basically uses #EnableOAuth2Sso annotation and the following properties
security.oauth2.client.client-id
security.oauth2.client.client-secret
security.oauth2.client.access-token-uri
security.oauth2.client.user-authorization-uri
security.oauth2.client.scope
security.oauth2.resource.user-info-uri
I can't do the same for google, so the problem should be in application.properties. I register my app with google, download the json that is given to me along with id & secret, but there seems to be missing the uri for security.oauth2.resource.user-info-uri property. I've searched online for that uri and tried to run the app with some values but with no success. Am I right that I need this property and how do I find it?
You need to request this information during authorization via scopes. This information is returned in the Identity Token and not the Access Token. If you requested the identity information you can also call the Google OAuth endpoint with the Access Token which returns the Identity Token.

Manually update access_token for google oauth2 in python

I'm using google oauthlib to get an access_token and use it to get gmail atom feed using requests because it is not supported by the python lib.
When using supported services such as drive, the token is automatically refreshed, how to do that in my case?
Assuming you have your refresh token you can use it to request a new Access token using HTTP POST
https://accounts.google.com/o/oauth2/token
client_id={ClientId}.apps.googleusercontent.com&client_secret={ClientSecret}&refresh_token=1/ffYmfI0sjR54Ft9oupubLzrJhD1hZS5tWQcyAvNECCA&grant_type=refresh_token
this Link may help Google 3 legged oauth2 flow

Resources