Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validating Google credentials

When you create credentials on Google Developer console You can create several different types of credentials depending upon which type is created you could have any of the following

  • Public API key
  • Client ID
  • Client Secret
  • Service account email address

They all have different formats. I have deleted the ones I am posting.

  • Public API key: AIzaSyAcMvMr_bk91qRKZ5SGYEvF5HWjXVE7Xkk
  • Client Id : 1046123799103-d0vpdthl4ms0soutcrpe036ckqn7rfpn.apps.googleusercontent.com
  • Client secret: G5QtTuBDp6ejKraR0XodNwaW
  • Service account email address: 1046123799103-6v9cj8jbub068jgmss54m9gkuk4q2qu8@developer.gserviceaccount.com

Is there any way to validate these in my application. What kind of keys are they?

I am using C# but any info on what kind of keys the are would be of help.

I could probably come up with some kind of RegEx check for client id and service account email. But there must be a way of validating them better then that.

Update:

Google lets you validate the access token why is there no way to validate the credentials TokenInfo validation

Not working.

Convert.FromBase64String("AIzaSyAcMvMr_bk91qRKZ5SGYEvF5HWjXVE7Xkk");
like image 630
DaImTo Avatar asked Nov 24 '15 09:11

DaImTo


People also ask

What is Google Auth credentials?

Credentials and account types Credentials are the means of identifying an application or user to a service or API. Credentials can be obtained with three different types of accounts: service accounts, user accounts and external accounts.


1 Answers

The only way to verify if the credentials are valid is try and use them and see if the server accepts them.

There is no checksum or algorithm you can check, Google did not specify a format for those tokens so they are allowed to change it at any time. You can only treat them as opaque blobs and just pass them off and see what the server responds.

like image 90
Scott Chamberlain Avatar answered Oct 22 '22 00:10

Scott Chamberlain