helium / hotspot-app

Helium hotspot app for iOS and Android
https://www.helium.com
Apache License 2.0
185 stars 138 forks source link

Deep linking returns invalid access token #1329

Open sitara-atlogys opened 2 years ago

sitara-atlogys commented 2 years ago

Describe the bug Hello team.I have found an issue that access token received through deep link (Link wallet feature) is not working with https://wallet.api.helium.systems api calls. It returns 401 status. When i debug the code of this repo then i found there is a mismatch between order of parameters https://github.com/helium/hotspot-app/blob/main/src/utils/secureAccount.ts#L136 and https://github.com/helium/hotspot-app/blob/main/src/features/txnDelegatation/LinkWallet.tsx#L49

So we need to move the time property after address in the makeAppLinkAuthToken function call, to fix it.

The problem is the key pair do sign the token object as it is. https://github.com/helium/hotspot-app/blob/main/src/utils/secureAccount.ts#L169

Expected behavior Token received through deep link should work with https://wallet.api.helium.systems api calls.

Additional context This is the token i received through deep link - eyJhZGRyZXNzIjoiMTNEdnFVb3FhOHJqYm5IejJUMmtSdG15eEhITkNXU0d3TTF5MmpQU1pWU0RtcDhDdkNGIiwidGltZSI6MTY1NjkzOTk3OSwic2lnbmF0dXJlIjoiS0NBdFhuRzhCVFVhV2JIYnZJTkQwZGVUZjM5TTFLcmpoWWdxYm42bk9zR2RSWnVwZG9vOFNWRXZkUG9NVTdRRUNMVlZPdlEwdUdKcE8yR1FSWjBpREE9PSJ9

This is the token created by my app itself

eyJhZGRyZXNzIjoiMTNEdnFVb3FhOHJqYm5IejJUMmtSdG15eEhITkNXU0d3TTF5MmpQU1pWU0RtcDhDdkNGIiwidGltZSI6MTY1NjkzOTI4Mywic2lnbmF0dXJlIjoiRjhNN0U0eFJHM2t3SGVaZGk5ay95bTV3VWE2NnNhaXJZVXZ3WFZ0azdFZy9TcDJGK0Jyc083eG5VUjVnU0xKVllSTVBrcXhqeEpmeWVYWlhvQldkRHc9PSJ9