Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.
This repository was archived by the owner on May 2, 2022. It is now read-only.

Unable to authenticate. TypeError: token.finally is not a function #3

Open

Description

@eejdev

After running the commands,

IDP=https://drive.verborgh.org
USERNAME=ruben
PASSWORD=ruben
URL=https://drive.verborgh.org/inbox/

curl "$URL" -H 'Authorization: Bearer '`solid-bearer-token "$IDP" "$USERNAME" "$PASSWORD" "$URL"`

I get the error,

token.finally(() => saveIdentityManager(identityManager, settingsFile));
             ^

TypeError: token.finally is not a function
    at Object.<anonymous> (/opt/conda/lib/node_modules/@solid/cli/bin/solid-bearer-token:24:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
Access to https://drive.verborgh.org/inbox/ requires authorization

Any suggestion about what the issue might be?

Thank you!

Activity

  1. RubenVerborgh commented on Nov 8, 2018

    @RubenVerborgh
    Contributor
  2. eejdev commented on Nov 14, 2018

    @eejdev
    Author

    Thank you. Updating it to node 8 solved the issue. However, I get a different issue.

    root@0c81d86e0603:/home/solid-cli# solid-bearer-token "$IDP" "$USERNAME" "$PASSWORD" "$URL"
    { FetchError: request to https://solid:8443/.well-known/openid-configuration failed, reason: self signed certificate
        at ClientRequest.<anonymous> (/usr/local/lib/node_modules/@solid/cli/node_modules/node-fetch/index.js:133:11)
        at ClientRequest.emit (events.js:182:13)
        at TLSSocket.socketErrorListener (_http_client.js:399:9)
        at TLSSocket.emit (events.js:182:13)
        at emitErrorNT (internal/streams/destroy.js:82:8)
        at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
        at process.internalTickCallback (internal/process/next_tick.js:72:19)
      name: 'FetchError',
      message:
       'request to https://solid:8443/.well-known/openid-configuration failed, reason: self signed certificate',
      type: 'system',
      errno: 'DEPTH_ZERO_SELF_SIGNED_CERT',
      code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }
    

    Do you have a suggestion on how to resolve it?

    EDIT:

    I added the line below to the bin/solid-bearer-token file which resolved the issue.

    process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" 
    

    However I run into yet another issue.

    root@0c81d86e0603:/home/solid-cli/bin# solid-bearer-token "$IDP" "$USERNAME" "$PASSWORD" "$URL"
    (node:1312) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
    { FetchError: request to https://localhost:8443/jwks failed, reason: connect ECONNREFUSED 127.0.0.1:8443
        at ClientRequest.<anonymous> (/home/solid-cli/node_modules/node-fetch/index.js:133:11)
        at ClientRequest.emit (events.js:182:13)
        at TLSSocket.socketErrorListener (_http_client.js:399:9)
        at TLSSocket.emit (events.js:182:13)
        at emitErrorNT (internal/streams/destroy.js:82:8)
        at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
        at process.internalTickCallback (internal/process/next_tick.js:72:19)
      name: 'FetchError',
      message:
       'request to https://localhost:8443/jwks failed, reason: connect ECONNREFUSED 127.0.0.1:8443',
      type: 'system',
      errno: 'ECONNREFUSED',
      code: 'ECONNREFUSED' }
    

    Import to note I am running my own solid server, inside a docker machine, and also a client, in another docker machine. I think its giving the localhost response but of course that is not the localhost in the client.

    I appreciate any help!

  3. RubenVerborgh commented on Nov 14, 2018

    @RubenVerborgh
    Contributor

    Yes, Node is right to give that warning.

    Not entirely sure why it is refused, is the server still running? Can you request that file from within a browser?

  4. RubenVerborgh commented on Nov 14, 2018

    @RubenVerborgh
    Contributor

    Actually, given you have a self-signed cert, you also want to run the server with bin/solid-test rather than bin/solid.

  5. solid-pay commented on Jan 22, 2019

    @solid-pay

    I get a similar error

    /usr/local/lib/node_modules/@solid/cli/bin/solid-bearer-token:24
    token.finally(() => saveIdentityManager(identityManager, settingsFile));
                 ^
    
    TypeError: token.finally is not a function
        at Object.<anonymous> (/usr/local/lib/node_modules/@solid/cli/bin/solid-bearer-token:24:14)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
        at Function.Module.runMain (module.js:693:10)
        at startup (bootstrap_node.js:188:16)
        at bootstrap_node.js:609:3
    

    node -v
    v8.10.0

    PS running against solid.community

  6. RubenVerborgh commented on Jan 22, 2019

    @RubenVerborgh
    Contributor

    @solid-pay Are you sure the Node version that is running the script is the same as the node version you get when doing node. (I have seen systems where that is not the case, that would be one possible explanation)

  7. solid-pay commented on Jan 22, 2019

    @solid-pay

    @RubenVerborgh thanks for the quick reply ( solidpay == melvin :) )

    I believe im using node 8, I tried from master :

    node -v
    v8.10.0
    
    node bin/solid-bearer-token https://melvin.solid.community secret secret https://melvin.solid.community/inbox
    /home/melvin/mel/solid-cli/bin/solid-bearer-token:24
    token.finally(() => saveIdentityManager(identityManager, settingsFile));
                 ^
    
    TypeError: token.finally is not a function
        at Object.<anonymous> (/home/melvin/mel/solid-cli/bin/solid-bearer-token:24:14)
    
  8. RubenVerborgh commented on Jan 23, 2019

    @RubenVerborgh
    Contributor

    Very weird, what does a console.log of token give?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions