0

Working with YouTube Data API v3 I want to get Access token using this tutorial: https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps

[[CODE]] : 4%2F0AdQt8qiarZnP_RFvafYA-ABLABLA*UpZ6YlB1_Byzrvqfm9iRthXll6F6TfG_f-cGw

[[CLIENT_ID]] : 27501137863BLABLA*sd2918n2gqqclurlegm6j2.apps.googleusercontent.com

[[CLIENT_SECRET]] : GOCSPX-T0lF1yVLJ*BLABLAGgfL7qvcwB5p

I send a POST request: screenshot: https://i.stack.imgur.com/LVaUx.png

I get a 400 error, What's wrong?:

Status: 400

Pragma: no-cache
Date: Thu, 11 Aug 2022 18:14:44 GMT
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Content-Type: application/json; charset=utf-8
Vary: X-Origin
Vary: Referer
Server: scaffolding on HTTPServer2
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

{
  "error": "redirect_uri_mismatch",
  "error_description": "Bad Request"
}```


1
  • When posting images of applications its really a good idea to swap the app over to English so that everyone on SO can read your app. Also giving the name of the app would be a good idea to. Welcome to stack Aug 11, 2022 at 18:34

1 Answer 1

0

Your endpoint is wrong to start with its https://oauth2.googleapis.com/token Thats why you are getting a 404

POST /token HTTP/1.1
Host: oauth2.googleapis.com
Content-Type: application/x-www-form-urlencoded

code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7&
client_id=your_client_id&
client_secret=your_client_secret&
redirect_uri=https%3A//oauth2.example.com/code&
grant_type=authorization_code

You may want to try watching this Understanding Google OAuth 2.0 with curl or this How to set up Oauth2 in PostMan. although im not sure if what you are using is postman or not.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.