dakshsinghrathore / Brighter-Beginnings

Discover coding for beginners in our GitHub repo! Enjoy a free three-module course, an interactive learning experience, and a supportive community. Your journey to a brighter future starts now! Join us!
https://brighter-beginnings.vercel.app
MIT License
29 stars 55 forks source link

BUG: Remove firebase auth and implement appwrite authentication #71

Open siwamsingh opened 8 months ago

siwamsingh commented 8 months ago

Is there an existing issue for this?

What happened?

  1. Create a new branch named 'auth' in the repository.

  2. Remove the Firebase authentication from the current login button functionality.

  3. Implement Appwrite for handling login and registration. Develop an authService class containing methods for login and registration.

  4. Feel free to reach out for any clarifications on these tasks.

  5. Introduce an alert box that pops up when the "Get Started" button is clicked, notifying the user to log in if they are not currently authenticated.

  6. Discord -id : siwam_singh

Record

github-actions[bot] commented 8 months ago

Congratulations, @siwamsingh! 🎉 Thank you for creating your issue. Your contribution is greatly appreciated and I look forward to work with you to resolve the issue. Keep up the great work!

I will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check my contributing guidelines

adityanandanx commented 8 months ago

I want to work on this @dakshsinghrathore

dakshsinghrathore commented 8 months ago

Assigned this issue to @iMADi-ARCH , kindly drop a star on this repo HAPPY CODING !

adityanandanx commented 8 months ago

I am trying to use the cdn version of appwrite -

<script src="https://cdn.jsdelivr.net/npm/appwrite@13.0.1"></script>

But it doesn't seem to work. I keep getting -

Uncaught ReferenceError: Client is not defined
    at index.html:550:20
    // inside script tag of index.html file -
    class AuthService {
      constructor() {
        this.client = new Client();
        this.client
          .setEndpoint("https://cloud.appwrite.io/v1")
          .setProject("659ed1cb2241fa3a86d3");
        this.account = new Account(client);
        this.user = null;
        this.init();
      }

      async init() {
        this.user = await this.account.get();
      }

      async login(email, password) {
        await this.account.createEmailSession(email, password);
      }
    }
    // Authentication
    const authService = new AuthService();
    console.log(authService);
    document.getElementById("login").addEventListener("click", async (e) => {
      await authService.login("email@email.com", "password");
      window.location.href = "getstarted.html";
      console.log(authService.user);
    });
siwamsingh commented 8 months ago

Instead of

this.client = new Client();
        this.client
          .setEndpoint("https://cloud.appwrite.io/v1")
          .setProject("659ed1cb2241fa3a86d3");

Use this

this.client = new Client().setEndpoint("https://cloud.appwrite.io/v1")
          .setProject("659ed1cb2241fa3a86d3");
siwamsingh commented 8 months ago

Instead of importing the class making object everytime at different locations, make object once in its file and import that single object everywhere .

Shaba1406 commented 8 months ago

@iMADi-ARCH what's the update??