Skip to content

add Dgraph's authentication token #29

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

Closed
wants to merge 3 commits into from
Closed

Conversation

MichelDiz
Copy link
Contributor

@MichelDiz MichelDiz commented Aug 13, 2020

Add support for Dgraph's authentication token.


This change is Reviewable

Add support for Dgraph's authentication token.
@MichelDiz MichelDiz requested review from paulftw and danielmai August 13, 2020 06:18
@paulftw
Copy link

paulftw commented Aug 14, 2020

Hey @MichelDiz please take a look at cf306a5

I've merged it yesterday as part of adding support for Slash.
I think it allows adding auth tokens to /alter via options.
And also does a couple more things differently: allows users to specify arbitrary headers, allows adding headers to /query and /mutate as well as /alter (that matters for Slash).

In Ratel I do

    const stub = new dgraph.DgraphClientStub(
        url,
        {
            jsonParser: JSONbigint.parse.bind(JSONbigint),
        },
        {
            headers: {
                "X-Auth-Token": "wrK9gCu1fyARDnaZuxR/zvdewK8oiphXpMb6mTxfaW0=",
            },
        },
    );

and then all calls have token inserted.

That one doesn't have documentation though. and could benefit from an explicit setter -- stub.setAuthToken() or something

@MichelDiz
Copy link
Contributor Author

@danielmai can you confirm if this PR and the commit from Paul is the same thing?

@paulftw
Copy link

paulftw commented Sep 2, 2020

Closing this one for now, since there are other ways to add custom headers to a stub

@paulftw paulftw closed this Sep 2, 2020
@MichelDiz
Copy link
Contributor Author

@paulftw and what are they? there are docs about it? If I had found anything I wouldn't even start this PR.

@joshua-goldstein joshua-goldstein deleted the micheldiz/addAuthToken branch June 3, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants