unable to login or implement angular-apollo graphql authentication, Added my implementation, Can someone help me #1791
Unanswered
manojkumaryalamati
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Api team provided this
query{
login(username: "user1", password: "password1") {
username
token
tokenExpiration
}
types.ts
const USER = gql
query{ login{ username token tokenExpiration } }
;export interface USER_DATA {
username:string;
token:string
tokenExpiration:string
}
onFormsubmit(){
this.apollo
.watchQuery({
query: USER,
variables: {
username: this.loginControls['username'].value,
password: this.loginControls['password'].value,
},
})
.valueChanges.subscribe(({ data, loading }) => {
// localStorage.setItem("token", data);
console.log(loading);
console.log('data', data);
});
}
After form submit my payload
{"variables":{"username":"test","password":"test"},"query":"{\n login {\n username\n token\n tokenExpiration\n __typename\n }\n}"}
Beta Was this translation helpful? Give feedback.
All reactions