Search code examples
node.jsoauthgoogle-apigoogle-oauthgoogle-developers-console

How to check if Google Client_ID and Client_Secret Valid or not


I am making a module in Node.js where the user can make their own Livestream Bot for youtube. The module requires the user to provide their client id and client secret of their application. But how do I check if the client id and client secret they entered is valid and if it isn't throw an appropriate error. Is there an endpoint to do that?


Solution

  • There is no way of validating the client id or the client secret. The only way is to try them and if they dont work then display an error to the user.

    You could maybe come up with a regex test for the client_id but i wouldn't recommend it as the format has changed several times over the years which would cause problems in your application.

    I would just say try to use it if it fails give them an error message.

    Note: I hope you are not prompting people to give you their client id and client secret as its against googles TOS for people to shire their client credentials if you are enc urging people to give you their credentials you are telling them to break the TOS.