Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing dots... at the end of the access_token #2839

Closed
jeromeSH26 opened this issue Nov 9, 2021 · 3 comments
Closed

Trailing dots... at the end of the access_token #2839

jeromeSH26 opened this issue Nov 9, 2021 · 3 comments
Labels
type: question Request for information or clarification. Not an issue.

Comments

@jeromeSH26
Copy link

Hi,
using googleapis auth to get a valid JWT for a service account.
the auth process is runninf will but when it comes to extract the access token from the Oauth client, its value has a bunch of dots at the end.
This leads to failing in authenticating when using this access token in some headers as an Authorization bearer.
We are several to have this issue
See Stoackoverflow post here
See post here

Example of my code

const jwt: JWT = new google.auth.JWT({
      email: this._googleAuthServiceAccountEmail,
      keyFile: this._googleAuthServiceAccountKeyFilePath,
      key: this._googleAuthServiceAccountKey,
      scopes: this._googleScopes,
      subject: this._googleAuthImpersonnatedEmail,
      keyId: this._googleAuthServiceAccountKeyId,
    });

await jwt.authorize();


console.log(jwt.gtoken?.accessToken) <--- returns something like ya29.c.Kp8BCgi0lxWtUt[rest token]....................................................................................

Why all these dots at the end ? How to get rid off them ?

Thks

@tmatsuo tmatsuo added the type: question Request for information or clarification. Not an issue. label Nov 9, 2021
@jeromeSH26
Copy link
Author

any idea ? the access_token can't be used which is blocking

@Harsimran1
Copy link

We are having the same issue. It is result in 500 errors when calling homegraph API which such access tokens.

@bshaffer
Copy link

These dots are placeholders to pad the tokens because Google will be increasing the token size (see oauth2-proxy/oauth2-proxy#1218):

On August 23, 2021, we will roll out security and reliability improvements that will increase the sizes of OAuth 2.0 access tokens for all projects.

The padding does not affect the verification of the token (e.g. you can remove them), but it's recommended not to, so that you can verify your application will work when the token size increases. From the linked issue:

We strongly recommend that you use the documented token size limits of 2048 bytes and to remove any logic in your services/code that restricts its ability to process access tokens of certain sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants