Giter Club home page Giter Club logo

Comments (17)

eldadfux avatar eldadfux commented on May 6, 2024 1

Actually we completely missed the Electron app scenario, but it should be an easy fix.

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

Correct code should be:

// Init SDK
let client = new sdk.Client();

let auth = new sdk.Auth(client);

But when I set Endpoint to http://localhost or http://localhost/v1 i get 404 or 403

{ StatusCodeError: 403 - {"message":"Access from this client host is forbidden. URL host must be one of: https://appwrite.io, https://appwrite.test, http://appwrite.test, https://localhost, http://localhost, https://appwrite.io, https://appwrite.test, http://appwrite.test, https://localhost, http://localhost","code":403,"file":"/usr/share/nginx/html/app/app.php","line":89,"trace":[{"function":"{closure}","args":[]},{"file":"/usr/share/nginx/html/vendor/utopia-php/framework/src/App.php","line":387,"function":"call_user_func_array","args":[{},[]]},{"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"}

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

I wanted use appwrite with ElectronApp so I don't want set any URL in Platforms :/

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

Yeh sorry about it, will make sure to fix it by the end of the day. Thanks for paying attention @GrzegorzZajac000 !

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

About the 403 I'll send you a fix later today.

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

Thanks @eldadfux ;)

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

@eldadfux any new info about support for Electron App?

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

@GrzegorzZajac000 This should allow you to workaround the issue until we release next version with a fix:

let client = new sdk.Client();
client.addHeader('origin', 'http://localhost');

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

Unfortunately this solution doesn't work :(
Response is the same

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

client.addHeader('Origin', 'http://localhost');

maybe with a capital letter? 🧐

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

Nope :/ It doesn't work too

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

Sorrry, are you using the JS SDK?

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

NodeJS SDK

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

Please paste the complete code example so I can run it from my machine.

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024
const sdk = require('node-appwrite');

// Init SDK
let client = new sdk.Client();
client.addHeader('Origin', 'http://localhost');

let auth = new sdk.Auth(client);

client
	.setProject('PROJECT_ID')
	.setEndpoint('http://localhost/v1')
	.setKey('');

let promise = auth.register('[email protected]', 'password', 'https://example.com');

promise.then(function (response) {
	console.log(response);
}, function (error) {
	console.log(error);
});

from appwrite.

eldadfux avatar eldadfux commented on May 6, 2024

@GrzegorzZajac000 This example works for me:

const sdk = require('node-appwrite');

// Init SDK
let client = new sdk.Client();
//client.setSelfSigned(true);
client.addHeader('Origin', 'http://localhost');

let auth = new sdk.Auth(client);

client
	.setProject('project_id')
	.setEndpoint('https://localhost/v1')
	//.setKey('')
;

let promise = auth.register(
    '[email protected]',
    'password',
    'https://localhost/confirm',
    'https://localhost/success',
    'https://localhost/failure',
    'my name'
);

promise.then(function (response) {
	console.log(response);
}, function (error) {
	console.log(error);
});

from appwrite.

GrzegorzZajac000 avatar GrzegorzZajac000 commented on May 6, 2024

Hmmm, it works! I had to do something wrong :) Thank you 👍

from appwrite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.