MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / doLogin

Method doLogin

dgraphapi/cluster.go:192–215  ·  view source on GitHub ↗
(params GraphQLParams, isAdmin bool)

Source from the content-addressed store, hash-verified

190}
191
192func (hc *HTTPClient) doLogin(params GraphQLParams, isAdmin bool) error {
193 resp, err := hc.RunGraphqlQuery(params, isAdmin)
194 if err != nil {
195 return err
196 }
197 var r struct {
198 Login struct {
199 Response struct {
200 AccessJWT string
201 RefreshJwt string
202 }
203 }
204 }
205 if err := json.Unmarshal(resp, &r); err != nil {
206 return errors.Wrap(err, "error unmarshalling response into object")
207 }
208 if r.Login.Response.AccessJWT == "" {
209 return errors.Errorf("no access JWT found in the response")
210 }
211
212 hc.HttpToken.AccessJwt = r.Login.Response.AccessJWT
213 hc.HttpToken.RefreshToken = r.Login.Response.RefreshJwt
214 return nil
215}
216
217func (hc *HTTPClient) ResetPassword(userID, newPass string, nsID uint64) (string, error) {
218 const query = `mutation resetPassword($userID: String!, $newpass: String!, $namespaceId: Int!){

Callers 3

LoginUsingTokenMethod · 0.95
LoginIntoNamespaceMethod · 0.95
LoginIntoNamespaceV20Method · 0.95

Calls 2

RunGraphqlQueryMethod · 0.95
ErrorfMethod · 0.45

Tested by

no test coverage detected