Skip to content

Invalid Token with OAuth #672

@ghost

Description

Hi, I use Strophe.js 1.6.0. When i want to connect to ejabberd i get the message that my token is invalid:

SENT: AGFkbWluQGx------------------------------------------------

RECEIVED: Invalid token

The way I initiate:

    const xmppServer = 'my-chat.de';
    const xmppUsername = 'admin';
    const oauthToken = 'xxxxxxxxxxxxxxxxxxxiKjRErde70gWwTR1';
    const boshEndpoint = `https://${xmppServer}/bosh`;

    const from = `${xmppUsername}@${xmppServer}`;
    const to = '[email protected]';

    // Baut Verbindung zu bosh auf.
    const connection = new Strophe.Connection(boshEndpoint);

    const saslOAuthBearer = new Strophe.SASLMechanism(connection);
    saslOAuthBearer.priority = 40;
    saslOAuthBearer.isClientFirst = false; // Setze isClientFirst auf false

    connection.connect(from, oauthToken, (status, condition) => {
            ........
    },
        null,
        null,
        xmppServer,
        {
        mechanism: 'X-OAUTH2',
        oauth_token: oauthToken
    });
    //console.log(saslOAuthBearer);
    console.log(connection);

Tokens are valid and ejabberd works fine with other clients:
xxxxxxxxxxxxxxxxxxxMPUMWUrWxi7gikDN [email protected] [<<"ejabberd:user">>] 3515141 seconds
[email protected] [<<"ejabberd:user">>] 3516603 seconds
xxxxxxxxxxxxxxxxxxx5iUQJZ8jrziUn8Qd [email protected] [<<"ejabberd:admin">>] 3512742 seconds
xxxxxxxxxxxxxxxxxxxdZwjBwhau0C4nXvEpt [email protected] [<<"sasl_auth">>] 217439 seconds
xxxxxxxxxxxxxxxxxxxa5QFXDaY89qcN7iA [email protected] [<<"ejabberd:admin">>] 217379 seconds
xxxxxxxxxxxxxxxxxxxwZnjqzHPM4fZYv [email protected] [<<"sasl_auth">>,<<"get_roster">>] 217448 seconds

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