Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Error: JWT has expired #16

Open
mokn opened this issue Dec 7, 2017 · 10 comments
Open

Error: JWT has expired #16

mokn opened this issue Dec 7, 2017 · 10 comments

Comments

@mokn
Copy link

mokn commented Dec 7, 2017

Was part of a hackathon a few months ago and we used the uport box to bootstrap the project. It was working then but not now. Trying to get this to work but continue receiving this error: Error: JWT has expired.

Code we had working 2 months ago was: export let uport = new Connect('TruffleBox');.

Project is at - https://github.com/micksabox/ethwaterloo2017

Any idea why this may be happening and how I can fix?

@ToJen
Copy link

ToJen commented Dec 16, 2017

I think that's still the same line in src/util/connectors.js. I have the same error, can't even login. I was at EthWaterloo too :)

@ingcoders
Copy link

This is due to clock on the device not being in sync.

@ToJen
Copy link

ToJen commented Dec 16, 2017

Thanks @ingcoders, in sync with what exactly?

@mdtanrikulu
Copy link

mdtanrikulu commented Dec 23, 2017

Problem is in given line for the used version of uport library: https://github.com/uport-project/uport-js/blob/e8803dc2b6f2bf4213ff188f1dd930cc01e4ba9a/src/JWT.js#L29

payload.exp timestamp has 10 char but, new Date().getTime() has 13. So even if payload.exp bigger than current timestamp, because of this character difference current time is always bigger.
I think they solved this with their current version, but if you want to do quickfix this issue you can use simply;

Math.floor(new Date().getTime()/1000))

instead of

new Date().getTime()

@wrannaman
Copy link

wrannaman commented Dec 24, 2017

I solved this by creating an app in uPort

  1. create an app in uport
  2. copy the code at the bottom under 'Click Here for your App Code'
  3. Change
import { Connect } from 'uport-connect
export let uport = new Connect('TruffleBox')
export const web3 = uport.getWeb3()

to

import { Connect, SimpleSigner } from 'uport-connect'

export const uport = new Connect('Test Ap 1', {
  clientId: 'xxx',
  network: 'rinkeby',
  signer: SimpleSigner('xxx')
})
export const web3 = uport.getWeb3()

@ToJen
Copy link

ToJen commented Dec 24, 2017

@wrannaman thanks man! can't believe i missed that haha

@ToJen
Copy link

ToJen commented Dec 24, 2017

@wrannaman where did you add the requestCredentials and attestCredentials functions?

@ToJen
Copy link

ToJen commented Dec 24, 2017

nvm it's in /src/user/ui/loginbutton/LoginButtonActions.js, at least for requestCredentials

@kishorebhatia
Copy link

@wrannaman trying to integrate uport-connect with our DApp and this was a life saver today (in the #EthDenver2018 hackathon)! Thanks a bunch!

@Ejdems666
Copy link

I just updated the uport-connect package to current version 0.7.1 and it worked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants