Issues with API KEY and SALT KEY after generation!

244 views
Skip to first unread message

suraj

unread,
Oct 31, 2019, 5:29:53 AM10/31/19
to Tinode General


~$ $GOPATH/bin/server -config=$GOPATH/src/github.com/tinode/chat/server/tinode.conf -static_data=$HOME/tinode/webapp/

2019/10/31 14:57:08 Server v0.16:/Users/hanuman/go/bin/server:undef; db: 'mysql'; pid 51128; 4 process(es)

2019/10/31 14:57:08 Using config from '/Users/hanuman/go/src/github.com/tinode/chat/server/tinode.conf'

2019/10/31 14:57:08 Running as a standalone server.

2019/10/31 14:57:08 Restricted tags: ['tel' 'email' 'basic']

2019/10/31 14:57:10 plugins: no active plugins found

2019/10/31 14:57:10 gRPC/1.25.0-dev server is registered at [:6061]

2019/10/31 14:57:10 Serving static content from '/Users/hanuman/tinode/webapp/' at '/'

2019/10/31 14:57:10 Large media handling enabled s3

2019/10/31 14:57:10 stats: variables exposed at '/debug/vars'

2019/10/31 14:57:10 Listening for client HTTP connections on [:6060]

2019/10/31 14:57:25 invalid apikey signature

2019/10/31 14:57:25 ws: Missing, invalid or expired API key

2019/10/31 14:57:31 invalid apikey signature

2019/10/31 14:57:31 ws: Missing, invalid or expired API key

2019/10/31 14:57:39 invalid apikey signature

2019/10/31 14:57:39 ws: Missing, invalid or expired API key

Gene

unread,
Oct 31, 2019, 5:34:07 AM10/31/19
to Tinode General
Have you updated the client to use the same key as the server?

Gene

unread,
Oct 31, 2019, 5:34:32 AM10/31/19
to Tinode General
Have you updated the server config with correct salt?

suraj

unread,
Oct 31, 2019, 5:37:58 AM10/31/19
to Tinode General
YES. I've updated the salt key in server and API KEY in client side!

Gene

unread,
Oct 31, 2019, 5:40:07 AM10/31/19
to Tinode General


On Thursday, October 31, 2019 at 12:37:58 PM UTC+3, suraj wrote:
YES. I've updated the salt key in server and API KEY in client side!

If you did everything correctly then it should work. You have the source code, figure it out.

suraj

unread,
Oct 31, 2019, 5:50:09 AM10/31/19
to Tinode General

API key v1 seq1 [ordinary]: AQAAAAABAABsqzxOhbGEF-wx3qFSAI8P

Used HMAC salt: V/EVUR+0xNsrwysP9Gju7s3gfoc4qUC63hGzyB5rGFs=



******* SERVER (tinode.conf) *****************


// Salt for signing API key. 32 random bytes base64-encoded. Use 'keygen' to generate

// the API key and the salt.

"api_key_salt": " ???????",





// Token authentication

"token": {

// Lifetime of a security token in seconds. 1209600 = 2 weeks.

"expire_in": 1209600,


// Serial number of the token. Can be used to invalidate all issued tokens at once.

"serial_num": 1,


// Secret key (HMAC salt) for signing the tokens. Generate your own then keep it secret.

// 32 random bytes base64 encioded.

//

// === IMPORTANT ===

//

// CHANGE IT IN PRODUCTION!!! Otherwise anyone will be able to log in

// to your server without the password.

"key": "???????????"

}

},




**** CLIENT SIDE ********


// API key. Use https://github.com/tinode/chat/tree/master/keygen to generate your own
export const API_KEY = 'AQAAAAABAABsqzxOhbGEF-wx3qFSAI8P';


Can you tell where to user the key in place of ?????? from above code.

Please tell if I'm missing anything?

Thnks!

Gene

unread,
Oct 31, 2019, 6:05:30 AM10/31/19
to Tinode General
On Thursday, October 31, 2019 at 12:50:09 PM UTC+3, suraj wrote:

API key v1 seq1 [ordinary]: AQAAAAABAABsqzxOhbGEF-wx3qFSAI8P


This API key goes to clients.
 

Used HMAC salt: V/EVUR+0xNsrwysP9Gju7s3gfoc4qUC63hGzyB5rGFs=


This salt goes to server config "api_key_salt"

suraj

unread,
Oct 31, 2019, 6:27:09 AM10/31/19
to Tinode General
Still same issue,

2019/10/31 15:55:32 invalid apikey signature

2019/10/31 15:55:32 ws: Missing, invalid or expired API key



Can you please tell what is  // === IMPORTANT === And (What needs to be changed in "key" = ????????)
// Token authentication
"token": {
// Lifetime of a security token in seconds. 1209600 = 2 weeks.
"expire_in": 1209600,

// Serial number of the token. Can be used to invalidate all issued tokens at once.
"serial_num": 1,

// Secret key (HMAC salt) for signing the tokens. Generate your own then keep it secret.
// 32 random bytes base64 encioded.
//
// === IMPORTANT ===
//
// CHANGE IT IN PRODUCTION!!! Otherwise anyone will be able to log in
// to your server without the password.
"key": "wfaY2RgF2S1OQI/ZlK+LSrp1KB2jwAdGAIHQ7JZn+Kc="

Gene

unread,
Oct 31, 2019, 7:03:29 AM10/31/19
to Tinode General
Did you rebuild the clients with the new key? Do you see them in the server logs?

suraj

unread,
Oct 31, 2019, 8:49:10 AM10/31/19
to Tinode General
Yes, Rebuild done! 

Things are working well in Firefox browser. But in chrome its showing the same errors as invalid key !!

Elvis Yang

unread,
Jul 17, 2021, 9:40:59 AM7/17/21
to Tinode General
Hi suraj

Did you solve the problem?

Hi Gene

I tried to generate key using keygen and add them into tinode.conf of server and config.js in src.

API key v1 seq1 [ordinary]: AQAAAAABAACvHfpg88Ix6osHgaX8fyUC

Used HMAC salt: pgBnG0ICuW0HkSNOI/HKM/JORffKrlRecNIxnAL1XBc=


I build with the following command:
npm run build

And I search the apikey in index.*.js and the api key did exist.

However, I still get "ws: Missing, invalid or expired API key", anything to try?

Gene

unread,
Jul 17, 2021, 11:58:58 AM7/17/21
to Tinode General
Make sure you clear the browser and app caches after rebuilding the apps with the new keys.


> And I search the apikey in index.*.js and the api key did exist.

Search for it in the js code loaded into the browser, not in the code you have on disk.

Search for it in the javascript code loaded in the browser. 

Gene

unread,
Jul 17, 2021, 12:00:03 PM7/17/21
to Tinode General
It's almost certainly cache-related.

Elvis Yang

unread,
Jul 17, 2021, 1:25:56 PM7/17/21
to Tinode General
I tried to unregister the service-worker and it works now, thanks.

Andrey M.

unread,
Sep 9, 2023, 9:32:29 AM9/9/23
to Tinode General
Hi,  tell me please how use the generator?
No matter where I run the command './keygen' it gives an error: «bash: ./keygen: No such file or directory»
What is the file folder for then? '$GOPATH/pkg/mod/github.com/tinode/ch...@v0.22.10/keygen'
Thanks.

суббота, 17 июля 2021 г. в 20:25:56 UTC+3, Elvis Yang:

Gene

unread,
Sep 9, 2023, 12:49:49 PM9/9/23
to Tinode General
On Saturday, September 9, 2023 at 6:32:29 AM UTC-7 Andrey M. wrote:
Hi,  tell me please how use the generator?
No matter where I run the command './keygen' it gives an error: «bash: ./keygen: No such file or directory»
What is the file folder for then? '$GOPATH/pkg/mod/github.com/tinode/ch...@v0.22.10/keygen'

Did you build it from sources or installed the binaries? 

Андрій М.

unread,
Sep 9, 2023, 12:52:39 PM9/9/23
to tin...@googlegroups.com
No, what do I need to install?


сб, 9 сент. 2023 г., 19:49 Gene <ge...@tinode.co>:
--
You received this message because you are subscribed to a topic in the Google Groups "Tinode General" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tinode/aSTi1ablh38/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tinode+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tinode/1e3fae7d-f195-4646-a054-3c6b0dfcd84en%40googlegroups.com.

Gene

unread,
Sep 9, 2023, 12:56:19 PM9/9/23
to Tinode General
On Saturday, September 9, 2023 at 9:52:39 AM UTC-7 Andrey M. wrote:
No, what do I need to install?

If you want execute keygen then you need keygen.

Andrey M.

unread,
Sep 9, 2023, 12:58:49 PM9/9/23
to Tinode General
Tell me please what I need to do on Debian?

суббота, 9 сентября 2023 г. в 19:56:19 UTC+3, Gene:

Gene

unread,
Sep 9, 2023, 1:07:06 PM9/9/23
to Tinode General
On Saturday, September 9, 2023 at 9:58:49 AM UTC-7 Andrey M. wrote:
Tell me please what I need to do on Debian?

Assuming your architecture is amd64, download the release tarball, for example https://github.com/tinode/chat/releases/download/v0.22.10/tinode-mysql.linux-amd64.tar.gz, unpack it, find keygen and run it.

Andrey M.

unread,
Sep 9, 2023, 1:17:34 PM9/9/23
to Tinode General
Gene, Thank you!!
Why don't you include a ready-made "keygen" file for use?


суббота, 9 сентября 2023 г. в 20:07:06 UTC+3, Gene:

Gene S

unread,
Sep 9, 2023, 1:25:05 PM9/9/23
to tin...@googlegroups.com
On Sat, Sep 9, 2023 at 10:17 AM Andrey M. <novop...@gmail.com> wrote:
Gene, Thank you!!
Why don't you include a ready-made "keygen" file for use?

I don't know what you mean. The keygen is included in the release tarball.
 
You received this message because you are subscribed to the Google Groups "Tinode General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinode+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tinode/7918b6c5-a765-4069-8fb8-7834ce8817bcn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages