How to proceed after getting authorization token -- Integrating Google Drive with Ionic

I have added a few lines of code to the basic Ionic blank template provided, with this on the home page:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { GoogleAuth, User } from '@ionic/cloud-angular';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  providers: []
})
export class HomePage {

  isLoggedIn:boolean = false;

  constructor(public navCtrl: NavController, public googleAuth: GoogleAuth, public user: User) {

  }

  login() {
    this.googleAuth.login().then(res => {
        alert(JSON.stringify(res));
        this.isLoggedIn = true;
    })
    .catch(err => console.error(err));

  }

  logout() {
    this.googleAuth.logout();
    this.isLoggedIn = false;
  }
}

I have also set up all the scopes I want (read-only access to Google Presentations) and other necessary stuff on Google Developers API console etc etc, and right now, I am able to get this when I test the code on my phone:

I believe that is the authorization token, and based on whatever I have read online, I am guessing that I have to somehow trade this token for an access token and a refresh token before I can call the Google Slides API. So, the question is: how do I proceed from here? How do I get the tokens I want, so that I can get to the API? Am I even right in saying that I have obtained the authorization code? I saw this:

To exchange an authorization code for an access token, call the https://www.googleapis.com/oauth2/v4/token endpoint and set the following parameters

on OAuth 2.0 for Mobile & Desktop Apps  |  Authorization  |  Google for Developers, but I have absolutely no idea what this means…

P.S. I’m very new to Ionic, Angular, APIs, mobile and web development, and my experimentations so far have required a lot of googling. However, because my questions tend to be very novice in nature, it is difficult to find a comprehensible answer to my queries. Hence, patient guidance is very much appreciated! :sweat:

1 Like