patrickfav / rocketchat-exporter

A simple script exporting chats from a rocket chat instance using the public REST API. Useful if no administrative access is possible.
https://favr.dev/opensource/rocketchat-exporter
Apache License 2.0
24 stars 10 forks source link

java.lang.IllegalArgumentException: invalid credentials #5

Open devZer0 opened 3 years ago

devZer0 commented 3 years ago

hello,

i have problems with your tool, i tried email and username for -u , but if fails for both.

we are migrating different rocketchat channels and want to preserve the old content.

can you help?

regards roland


# java -jar ./rocketchat-exporter-1.1.0.jar --host "https://rocketchat.wechange.de" -o ./out -u "<myusername>" --debug
Please enter your RocketChat password:

Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: --> POST https://rocketchat.wechange.de/api/v1/login
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Content-Type: application/json; charset=UTF-8
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Content-Length: 63
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO:
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: {"user":"<myusername>","password":"<mypassword>"}
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: --> END POST (63-byte body)
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: --> POST https://rocketchat.wechange.de/api/v1/login h2
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Content-Type: application/json; charset=UTF-8
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Content-Length: 63
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Host: rocketchat.wechange.de
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Connection: Keep-Alive
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: Accept-Encoding: gzip
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: User-Agent: okhttp/3.14.3
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO:
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: {"user":"<myusername>","password":"<mypassword>"}
Apr 10, 2021 1:07:54 PM okhttp3.internal.platform.Platform log
INFO: --> END POST (63-byte body)
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: <-- 401 https://rocketchat.wechange.de/api/v1/login (746ms)
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: server: nginx
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: date: Sat, 10 Apr 2021 11:07:55 GMT
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: content-type: application/json
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-xss-protection: 1
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-content-type-options: nosniff
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-instance-id: BsyBTmrTgQZHk3MDz
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: cache-control: no-store
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: pragma: no-cache
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-ratelimit-limit: 10000
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-ratelimit-remaining: 9999
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-ratelimit-reset: 1618052934684
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: access-control-allow-origin: *
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, X-User-Id, X-Auth-Token
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: vary: Accept-Encoding
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: content-encoding: gzip
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO:
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: {"status":"error","error":"Unauthorized","message":"Unauthorized"}
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: <-- END HTTP (66-byte, 65-gzipped-byte body)
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: <-- 401 https://rocketchat.wechange.de/api/v1/login (1066ms)
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: server: nginx
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: date: Sat, 10 Apr 2021 11:07:55 GMT
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: content-type: application/json
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-xss-protection: 1
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-content-type-options: nosniff
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-instance-id: BsyBTmrTgQZHk3MDz
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: cache-control: no-store
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: pragma: no-cache
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-ratelimit-limit: 10000
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-ratelimit-remaining: 9999
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: x-ratelimit-reset: 1618052934684
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: access-control-allow-origin: *
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, X-User-Id, X-Auth-Token
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: vary: Accept-Encoding
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO:
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: {"status":"error","error":"Unauthorized","message":"Unauthorized"}
Apr 10, 2021 1:07:55 PM okhttp3.internal.platform.Platform log
INFO: <-- END HTTP (66-byte body)
java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid credentials
    at at.favre.tools.rocketexporter.cli.Export.run(Export.java:158)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1729)
    at picocli.CommandLine.access$900(CommandLine.java:145)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1935)
    at picocli.CommandLine.execute(CommandLine.java:1864)
    at at.favre.tools.rocketexporter.cli.Export.main(Export.java:44)
Caused by: java.lang.IllegalArgumentException: invalid credentials
    at at.favre.tools.rocketexporter.RocketExporter$Default.login(RocketExporter.java:168)
    at at.favre.tools.rocketexporter.cli.Export.run(Export.java:68)
    ... 7 more
ConradSelig commented 1 year ago

I had this same issue - the problem was that I had 2FA enabled on the account I was trying to use the exporter with. Maybe yours is the same way?