Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

1 . appwrite only for testing purpose only , after devoloping the frontend we can wire it with our own backend . am i correct

2 .i dont understand that, how to handle my requiest . like lets say i want to make a login which is backed by appwrite self hosted server . what i usually do is make a post request to my backend server and the i will get the payload , base on that payload i can decide wheather to log this user or not

something like

{
"error":"false",
"usertype":"admin",
"jwt":"***************"
}

but with appwrite i have to provide a redirect url which i am not comfortable with. when i try to omit the redirect url ( i refferd the appwrite js sdk example example ) i get this error

{"message":"Invalid success: URL host must be one of: https:\/\/appwrite.io, https:\/\/appwrite.test, http:\/\/appwrite.test, https:\/\/localhost, http:\/\/localhost, http:\/\/localhost:3003\/","code":400,"file":"\/usr\/share\/nginx\/html\/vendor\/utopia-php\/framework\/src\/App.php","line":456,"trace":[{"file":"\/usr\/share\/nginx\/html\/vendor\/utopia-php\/framework\/src\/App.php","line":395,"function":"validate","class":"Utopia\\App","type":"->","args":["success",{"default":null,"validator":{},"description":"URL to redirect back to your app after a successful login attempt.","optional":false,"value":null},null]},{"file":"\/usr\/share\/nginx\/html\/app\/app.php","line":767,"function":"run","class":"Utopia\\App","type":"->","args":[{},{}]},{"file":"\/usr\/share\/nginx\/html\/public\/index.php","line":27,"args":["\/usr\/share\/nginx\/html\/app\/app.php"],"function":"include"}],"version":"0.2.0"}

source code

import React, { Component } from "react";

import * as Appwrite from "appwrite";

var appwrite = new Appwrite();

appwrite
  .setEndpoint("http://localhost/v1") // Set only when using self-hosted solution
  .setProject("5db3d1833763b");

class LoginPage extends Component {
  login = () => {
    console.log("in login");
    let pro = appwrite.auth.login("xxxxxxxxxx@gmail.com", "123123");
    pro
      .then(res => {
        console.log(res);
      })
      .catch(err => {
        console.log(err);
      });
  };

  render() {
    return (
      <div>
        hello
        <button onClick={() => this.login()}>login</button>
      </div>
    );
  }
}

export default LoginPage;

  1. something like self hosted serverless functions , like aws lambda , but with frontend freindly in appwrite , that would be very comfortable to use.and also it will be really flexible .

like lets say you want to implement a backend route for a shoping cart we can manually configure our parameters for that perticular request , and the we can share that request with the frontend devs aand backend devs the both parties will be able to work seperatly and devolop . after finishing they only need to connect forntend and backend and it will work as expected. like appwrite is between frontend and backend , in devolopment phase .

these are my opinions on Appwrite .

sometimes this may be something i still can't understand , because i am still a beginner and need more experiance to understand hard concepts. and also i am not familliar with session base authentication . i always work with JWT . because of that i might be not understanding the login example.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment