Create an App Displaying My Youtube Videos | C2C Community

Create an App Displaying My Youtube Videos

  • 2 October 2022
  • 2 replies

Userlevel 1

Hello. First time asking a question in the community. I would like to create a native android app displaying videos from my YouTube channel. I am having a difficult time figuring out how to get the access token.

Here is what I have figured out so far.

1. I know which APIs to call.

2. I created curls for these APIs


curl --location -g --request GET '{YOUR_USER_NAME}&key={YOUR_API_KEY}' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json'


curl --location -g --request GET '{YOUR_PLAYLIST_ID}&key={YOUR_API_KEY}' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json'

Due to not knowing where I can receive the access token, I am stuck.

3. I found a google api client library that seems to allow authentication behind the scenes, where you can receive an access token by only providing your api key which you generate on Google Cloud console. However, the class is deprecated.

implementation ''

The `GoogleCredential` class is deprecated.

4. After further research, I found another auth library. I thought that maybe this was a replacement for GoogleCrediential. However, I do not understand how to use it. What steps do I need to do exactly for GoogleCredentials.getApplicationDefault() to work?

implementation ''

Unfortunately, there isn’t too many code examples online. 

(1) I would like to add an access token to my curl script and get a successful response.
(2) I would like to know which libraries should be used for the type of application I want to build.


Best answer by ilias 3 October 2022, 08:33

View original

2 replies

Userlevel 7
Badge +65

Hi @drxeno02,

are you using Firebase, Firestore for your Android app or not?

Is it a Kotlin, Java, Flutter app?

Have you checked the two links below?

How to Get a YouTube API Key

OAuth 2.0 for Mobile & Desktop Apps


The more you tell us, the better for our members.

Userlevel 1


I am using Kotlin. And no, I am making API calls outside of Firebase and other Google services. I was using POSTMAN to play around with the APIs.

How to Get a YouTube API Key
I have reviewed this documentation. See this part of the article » 4. Try it out using Google’s API explorer tool. That is how I got my curl. The curl doesn’t work without an access token. This is my question, where do you get that access token. Somewhere there has to be an authentication endpoint or a /getToken endpoint. That is really where I am confused.

OAuth 2.0 for Mobile & Desktop Apps
Regarding this, I may have missed this documentation. Looks like I should try and use this curl.

curl \
--request POST \
--data "code=[Authentcation code from authorization link]&client_id=[Application Client Id]&client_secret=[Application Client Secret]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" \

I will try it. This looks like what I am looking for. Thank you!

Other references I found (for anyone else with the same issue):