js-sdk icon indicating copy to clipboard operation
js-sdk copied to clipboard

Add Google Bearer Token Flow

Open glitch003 opened this issue 1 year ago • 1 comments

Update: AuthMethod 5 - "Google" is broken on the nodes too. so, this PR is kind of pointless.

Original description: Ok so apologies since this is kind of confusing.

We support 2 google auth methods: 5 - "Google" - Traditional Bearer Token Oauth. The nodes resolve and verify the access token by sending it to google and using the response from Google 6 - "GoogleJwt" - JWT token auth. The nodes resolve the data in the token by parsing the JWT. The nodes verify the access token by retrieving the google certificates and checking against them.

Right now on Habanero and Manzano, 6 - "GoogleJwt" is broken, because the folder that should hold the google certificates doesn't exist and the node wasn't programmed to create it. This is already fixed in the node, but those changes haven't been deployed yet.

5 - "Google" should still work though! So, we can either deploy a whole network upgrade to fix auth method 6 - "GoogleJwt", or we can try and get users to use auth method 5 - "Google"

This PR is an attempt at adding support for auth method 5 - "Google". We've only ever implemented auth method 6 - "GoogleJwt" in the SDK since it's more efficient and better for the nodes to use this auth method. So therefore, when the user asks for an auth provider of type "google" it actually uses auth method 6 - "GoogleJwt".

I don't want to break this for existing users, so instead I added two new ProviderTypes: "googleJwt" which uses auth method 6 - "GoogleJwt" and"googleBearer" which uses auth method 5 - "Google". ProviderType "google" still maps to 6 - "GoogleJwt" which retains backward compatibility, but is indeed confusing.

glitch003 avatar Feb 21 '24 02:02 glitch003

Not sure if what you mentioned above is the cause of this (cayenne) or will block me from implementing the advised remedy when I transition to Manzano: https://discord.com/channels/896185694857343026/1197596414541303848

zach-is-my-name avatar Feb 24 '24 17:02 zach-is-my-name

do we still need this @glitch003 ?

Ansonhkg avatar Jul 11 '24 13:07 Ansonhkg

Closing for now due to inactivity. cc @glitch003

Ansonhkg avatar Jul 15 '24 15:07 Ansonhkg