create a developers account with google

google cloud platform enable the gmail api create an app create credentials make it externally available declare invited users and gmail permission scopes list https://developers.google.com/oauthplayground in authorized redirect uris

go to the playground and set the config cog to use your own credentials from your app sign in to the account that will be testing this app

get your refresh token/access tokens here