Coder Social home page Coder Social logo

amaury1093 / login-with-metamask Goto Github PK

View Code? Open in Web Editor NEW
676.0 676.0 295.0 10.98 MB

Demo project for "One-click Login with Blockchain: A MetaMask Tutorial"

Home Page: https://www.toptal.com/ethereum/one-click-login-flows-a-metamask-tutorial

License: MIT License

HTML 8.42% CSS 4.57% Dockerfile 1.16% TypeScript 84.44% JavaScript 1.41%
cryptography metamask one-click-login

login-with-metamask's Issues

Feature

Can a feature like this be implemented with a WP website?

Unable to compile

I think code in the tutorial is not the same that repository.... i am unable to compile

\login-with-metamask-demo\node_modules\ts-node\src\index.ts:500
[start:backend ] return new TSError(diagnosticText, diagnosticCodes)
[start:backend ] ^
[start:backend ] TSError: ⨯ Unable to compile TypeScript:
[start:backend ] src/services/users/controller.ts(12,23): error TS2345: Argument of type '"" | { where: { publicAddress: string | ParsedQs | string[] | ParsedQs[]; }; } | undefined' is not assignable to parameter of type 'FindOptions | undefined'.
[start:backend ] Type '""' is not assignable to type 'FindOptions | undefined'.

{error: "Signature verification failed"}

Hello,
From time to time i get this after login (if i login/logout for a few times) :

{error: "Signature verification failed"}

on the back-end i get this error in the console:
screen shot 2018-06-16 at 21 13 19

Then, on the frontend i see:

screen shot 2018-06-16 at 21 11 24

Here is my console on the frontend:

screen shot 2018-06-16 at 21 11 45

screen shot 2018-06-16 at 21 11 59

It has something to do with jwt token?

Can you tell mehow can i investigate where is the pb?

If i delete cookies on the app itself, I can login, but immediately throws that error...

I cannot figure why.

Fix frontend Dockerfile

Repro

docker-compose up --build

Expected

Runs backend and frontend

Actual

Cannot run frontend, got error

frontend_1  | ℹ 「wds」: Project is running at http://172.21.0.3/
frontend_1  | ℹ 「wds」: webpack output is served from /login-with-metamask-demo
frontend_1  | ℹ 「wds」: Content not from webpack is served from /app/public
frontend_1  | ℹ 「wds」: 404s will fallback to /login-with-metamask-demo/
frontend_1  | Starting the development server...
frontend_1  | 
frontend_1  | Failed to compile.
frontend_1  | 
frontend_1  | src/Login/Login.tsx
frontend_1  | Syntax error: Unexpected token, expected "," (38:16)
frontend_1  | 
frontend_1  |   36 | 
frontend_1  |   37 | 		// Check if MetaMask is installed
frontend_1  | > 38 | 		if (!(window as any).ethereum) {
frontend_1  |      | 		             ^
frontend_1  |   39 | 			window.alert('Please install MetaMask first.');
frontend_1  |   40 | 			return;
frontend_1  |   41 | 		}

The weird thing is, running it without Docker works:

cd packages/frontend
yarn start

Trouble locating the database so I can add token check

I am trying to build an app that authenticates whether or not a user's wallet contains a particular NFT. This app looks like a great foundation for this. I was thinking of making it so that after the user signs the nonce, web3 checks if the wallet contains a particular token balance. Is this project something that could be ported to what I'm describing?

Btw the dumb part of this question is that I can't find the actual database file. Where is this file getting written to the hard drive? I see the line storage: path.join(os.tmpdir(), 'db.sqlite'), in db.ts but for some reason I can't find this path after I run the program. I know that there is a persistent db because the app remembered my nickname which I typed in after signing in with my metamask.

Unable to access DB on Windows

Hey,

I receive this error message:

Unhandled rejection SequelizeConnectionError: SQLITE_CANTOPEN: unable to open database file at Database.connections.(anonymous function).lib.Database.err (C:\Users\Carlos\Downloads\auth\backend\node_modules\sequelize\lib\dialects\sqlite\connection-manager.js:66:63)

Where / How can I handle this error? I assume I need to connect my own DB to make it work, right?

Won't work in Opera

Just letting you know I can't get your demo to work in opera with metamask installed.

I am unable to run this

I don't know if i am missing something, i am just following steps from scratch and find myself hours here without success, just clone-> yarn install -> yarn start, and getting this.... any help appreciated please

[start:backend ] (sequelize) Warning: SQLite does not support 'INTEGER' with UNSIGNED or ZEROFILL. Plain 'INTEGER' will be used instead.
[start:backend ] >> Check: https://www.sqlite.org/datatype3.html
[start:backend ]
[start:backend ] [mylocalPATH]\login-with-metamask-demo\node_modules\express-jwt\lib\index.js:22
[start:backend ] if (!options.algorithms) throw new Error('algorithms should be set');

return User.findAll(whereClause) Fails with TSError: ⨯ Unable to compile TypeScript: When I remove Docker Files

I am building an app that incorporates the backend of this app with the Docker functionality removed. I only changed a few files.

  1. The package.json file: https://imgur.com/a/f0kfJZB
  2. The db.ts file: https://imgur.com/a/jr0ezuV
  3. Everything referencing Docker

Now I get this error in my terminal when I try to run the app in the backend folder with yarn start

<myusername>@<mycomputername> backend % yarn start
yarn run v1.22.17
$ ts-node src
(sequelize) Warning: SQLite does not support 'INTEGER' with UNSIGNED or ZEROFILL. Plain 'INTEGER' will be used instead. 
>> Check: https://www.sqlite.org/datatype3.html
/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:820
    return new TSError(diagnosticText, diagnosticCodes);
           ^
TSError: ⨯ Unable to compile TypeScript:
src/services/users/controller.ts:14:22 - error TS2345: Argument of type '{ where: { publicAddress: string | ParsedQs | string[] | ParsedQs[]; }; } | undefined' is not assignable to parameter of type 'FindOptions<any> | undefined'.
  Type '{ where: { publicAddress: string | QueryString.ParsedQs | string[] | QueryString.ParsedQs[]; }; }' is not assignable to type 'FindOptions<any>'.
    Types of property 'where' are incompatible.
      Type '{ publicAddress: string | QueryString.ParsedQs | string[] | QueryString.ParsedQs[]; }' is not assignable to type 'WhereOptions<any> | undefined'.
        Type '{ publicAddress: string | QueryString.ParsedQs | string[] | QueryString.ParsedQs[]; }' is not assignable to type 'WhereAttributeHash<any>'.
          Type '{ publicAddress: string | QueryString.ParsedQs | string[] | QueryString.ParsedQs[]; }' is not assignable to type '{ [x: string]: string | number | bigint | boolean | Buffer | Fn | Col | Literal | WhereAttributeHash<any> | Date | WhereOperators | ... 6 more ... | undefined; }'.
            Property 'publicAddress' is incompatible with index signature.
              Type 'string | ParsedQs | string[] | ParsedQs[]' is not assignable to type 'string | number | bigint | boolean | Buffer | Fn | Col | Literal | WhereAttributeHash<any> | Date | WhereOperators | ... 6 more ... | undefined'.
                Type 'ParsedQs[]' is not assignable to type 'string | number | bigint | boolean | Buffer | Fn | Col | Literal | WhereAttributeHash<any> | Date | WhereOperators | ... 6 more ... | undefined'.
                  Type 'ParsedQs[]' is not assignable to type 'WhereAttributeHash<any>'.
                    Type 'ParsedQs[]' is not assignable to type '{ [x: string]: string | number | bigint | boolean | Buffer | Fn | Col | Literal | WhereAttributeHash<any> | Date | WhereOperators | ... 6 more ... | undefined; }'.
                      Index signature for type 'string' is missing in type 'ParsedQs[]'.

14  return User.findAll(whereClause)
                        ~~~~~~~~~~~

    at createTSError (/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:820:12)
    at reportTSError (/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:824:19)
    at getOutput (/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:1014:36)
    at Object.compile (/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:1322:43)
    at Module.m._compile (/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:1454:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/<myusername>/Desktop/Dev/nft-reactor-content/backend/node_modules/ts-node/src/index.ts:1458:12)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  diagnosticCodes: [ 2345 ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
<myusername>@<mycomputername> backend % 

Do you see what the problem is?

Problem with running the demo

Hello!
Demo using yarn
The browser displays the following errors:

src\App\App.tsx
Line 36:8: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method

src\Profile\Profile.tsx
Line 38:9: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 39:9: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 60:9: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 61:9: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 61:9: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 72:55: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 88:8: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 90:8: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 94:8: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 94:8: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method
Line 96:27: Avoid referencing unbound methods which may cause unintentional scoping of this @typescript-eslint/unbound-method

How do I fix this?

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.