| 136 | } |
| 137 | |
| 138 | func (hc *HTTPClient) LoginIntoNamespace(user, password string, ns uint64) error { |
| 139 | // This is useful for v20.11 which does not support multi-tenancy |
| 140 | if ns == 0 { |
| 141 | return hc.LoginIntoNamespaceV20(user, password) |
| 142 | } |
| 143 | |
| 144 | q := `mutation login($userId: String, $password: String, $namespace: Int) { |
| 145 | login(userId: $userId, password: $password, namespace: $namespace) { |
| 146 | response { |
| 147 | accessJWT |
| 148 | refreshJWT |
| 149 | } |
| 150 | } |
| 151 | }` |
| 152 | params := GraphQLParams{ |
| 153 | Query: q, |
| 154 | Variables: map[string]interface{}{ |
| 155 | "userId": user, |
| 156 | "password": password, |
| 157 | "namespace": ns, |
| 158 | }, |
| 159 | } |
| 160 | |
| 161 | hc.HttpToken = &HttpToken{ |
| 162 | UserId: user, |
| 163 | Password: password, |
| 164 | } |
| 165 | return hc.doLogin(params, true) |
| 166 | } |
| 167 | |
| 168 | func (hc *HTTPClient) LoginIntoNamespaceV20(user, password string) error { |
| 169 | q := `mutation login($userId: String, $password: String) { |