Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Token with OAuth #672

Open
ghost opened this issue Aug 26, 2023 · 1 comment
Open

Invalid Token with OAuth #672

ghost opened this issue Aug 26, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 26, 2023

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 = 'test@my-chat.de';

    // 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 admin@my-chat.de [<<"ejabberd:user">>] 3515141 seconds
xxxxxxxxxxxxxxxxxxxiKjRErde70gWwTR1admin@my-chat.de [<<"ejabberd:user">>] 3516603 seconds
xxxxxxxxxxxxxxxxxxx5iUQJZ8jrziUn8Qd admin@my-chat.de [<<"ejabberd:admin">>] 3512742 seconds
xxxxxxxxxxxxxxxxxxxdZwjBwhau0C4nXvEpt testuser@my-chat.de [<<"sasl_auth">>] 217439 seconds
xxxxxxxxxxxxxxxxxxxa5QFXDaY89qcN7iA testuser@my-chat.de [<<"ejabberd:admin">>] 217379 seconds
xxxxxxxxxxxxxxxxxxxwZnjqzHPM4fZYv testuser@my-chat.de [<<"sasl_auth">>,<<"get_roster">>] 217448 seconds

@ghost ghost changed the title Invelid Token with OAuth Invalid Token with OAuth Aug 26, 2023
@Neustradamus

This comment was marked as spam.

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

No branches or pull requests

1 participant