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

Question about Storage module #679

Open
chatzich opened this issue Feb 10, 2022 · 9 comments
Open

Question about Storage module #679

chatzich opened this issue Feb 10, 2022 · 9 comments

Comments

@chatzich
Copy link

I read the documentation and I see that the storage API requests do not demand a token in order to authenticate the user who is requesting the resource am I correct ? or did I misunderstand it?

@cybaj
Copy link

cybaj commented Feb 14, 2022

functions:
  isAuthenticated: 'return !!request.auth'
  isOwner: "return !!request.auth && userId === request.auth['user-id']"
  validToken: 'return request.query.token === resource.Metadata.token'
paths:
  /user/:userId/:
    list: 'isOwner(userId)'
  /user/:userId/:fileId:
    read: 'isOwner(userId) || validToken()'
    write: 'isOwner(userId)'
  /public*:
    read: 'true'
    write: 'true'

as you can see, about public* path, no demanding a token.
but about user path, for a reading, demanding token or authentication.

@chatzich
Copy link
Author

@cybaj thank you for your answer my question is how do I send the token? Like bearer token {'Authentication: 'Bearer '' for example?

@cybaj
Copy link

cybaj commented Feb 14, 2022

@chatzich you can use get parameters which is at ends of the url. localhost/o/storage/some-path?token=sometoken

@chatzich
Copy link
Author

ok thank you for your answer I assume that the token is the token given by Hasura backend plus, right?

@cybaj
Copy link

cybaj commented Feb 14, 2022

@chatzich The token was send from Hasura backend plus, each time uploading object.
You can find that at API doc.

@chatzich
Copy link
Author

chatzich commented Feb 14, 2022

So there is a fixed token for every file, am I correct?

@cybaj
Copy link

cybaj commented Feb 14, 2022

@chatzich Yes, you are.

@chatzich
Copy link
Author

So I have to each token in database in order to retrieve it through hasura graphql server and after that use it to retrieve from hasura-backend-plus module, right?

@cybaj
Copy link

cybaj commented Feb 14, 2022

@chatzich Yes, I think so. You should store the token for the object file to get the file by token if you are not owner of the object file.

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

2 participants