How to login to user accounts in your lowcode Hypi app instance
Use Hypi APIs with ease!
written by:
Asawari P
The previous post demonstrated how to register user accounts in the Hypi App instance. Now, the next step is to login to the user accounts.
To perform CRUD and other operations on the Hypi domain, the user should login to the account
in the app instance. This generates a session token
which is used as an Authorization key to perform the operations.
Let’s see how to login to user accounts…
- A user may login by username or email.
login
is the API to login using username.
login(username:String!,password:String!): AccessToken
loginByEmail
is the API to login using email.
loginByEmail(email: String!,password: String!): AccessToken
- Provide the credentials used while registering the user account.
Sample Query
{
login(
username: "hypi-user",
password: "[email protected]"
) {
sessionToken
sessionExpires
errorCode
errorMsg
}
}
#OR
{
loginByEmail(email: "[email protected]", password: "[email protected]") {
sessionToken
sessionExpires
errorCode
errorMsg
}
}
#Result
{
"data": {
"login": {
"sessionToken": "session-token",
"sessionExpires": 1634889557,
"errorCode": null,
"errorMsg": null
}
}
}
Query with Variables
query HypiLogin($username: String!, $password: String!) {
login(username: $username, password: $password) {
sessionToken
sessionExpires
errorCode
errorMsg
}
}
#Query Variables
{
"username": "[email protected]",
"password": "[email protected]"
}
Again, check the POSTMAN
collection for the account login requests in different programming languages! Click </>
and choose the programming language of your choice.
Don’t forget to insert your own Authorization key and Hypi Domain under Headers to test the results!