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

Authentication with access token #85

Closed
bourdakos1 opened this issue Jun 1, 2021 · 7 comments
Closed

Authentication with access token #85

bourdakos1 opened this issue Jun 1, 2021 · 7 comments

Comments

@bourdakos1
Copy link

Is it possible to use this sdk with only a service instance ID and an access token? (no api key)

@nglange
Copy link
Contributor

nglange commented Jun 1, 2021

That's a good question. It is possible with the Java SDK, which makes me think it should be possible. I'll take a look and provide an update.

@nglange
Copy link
Contributor

nglange commented Jun 1, 2021

Yeah, looks like it's as easy as just providing a token instead of an apiKeyId during client creation. Here's the relevant code:

@bourdakos1
Copy link
Author

Thanks, I wasn't able to get token working, but I was able to pass a tokenManager:

new COS.S3({
  endpoint: "https://s3.us.cloud-object-storage.appdomain.cloud",
  serviceInstanceId: "...",
  // @ts-ignore
  tokenManager: {
    getToken: () => ({
      accessToken: token,
    }),
  },
});

Neither token or tokenManager are part of the typedefs

@IBMeric
Copy link
Member

IBMeric commented Jun 8, 2021

Has your issue been resolved?

@bourdakos1
Copy link
Author

Not exactly, I was able to do a work around, but there doesn’t seem to be an official way to do this?

@IBMeric
Copy link
Member

IBMeric commented Jun 21, 2021

@bourdakos1 Your resolution would be the "official" one I would suggest. There currently is no support for supplying a pre-fetched IAM token. For cases like this, we suggest extending the token manager with the behavior you are looking for. Also, re: typedefs, I've opened an internal ticket.

If this cover everything, please close this as resolved.

@bourdakos1
Copy link
Author

okay great, yea the typedef fix would cover everything thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants