How to get access_token for using chat?

How to get access_token for using chat?
I have tried to use chat. so I need access_token.
window.chatClient = new chatClient({
channel: ‘#CHANNELNAMEHERE’,
username: ‘USERNAMEHERE’,
password: ‘oauth:AUTHTOKENHERE’, <- I need how to get this token value in code(client javascript or node).
});

[Authentication>Node Sample source]
passport.use(‘twitch’, new OAuth2Strategy({
authorizationURL: ‘https://api.twitch.tv/kraken/oauth2/authorize’,
tokenURL: ‘https://api.twitch.tv/kraken/oauth2/token’,
clientID: TWITCH_CLIENT_ID,
clientSecret: TWITCH_SECRET,
callbackURL: CALLBACK_URL,
state: true
},
function(accessToken, refreshToken, profile, done) {
profile.accessToken = accessToken; <- Is different this token below?
profile.refreshToken = refreshToken;

// Securely store user profile in your DB
//User.findOrCreate(..., function(err, user) {
//  done(err, user);
//});

done(null, profile);

}
));

This section of the documentation covers token acquisition:

Can not use received accessToken from authentication flow ? I want to use it.

Why not?

Did you request the chat_login scope?

I used user_read at scope option.
So, I changed scope optoin as “chat_login”.
And then I get result “failed to fetch user profile”.

To get a user you don’t need any scope. (Sorry for reference to chat_login I confused this thread with another).

Covers how to fetch a users profile

um…
I think that I didn’t deliver what to want.
I do authentication for sign-in via twitch. And I take live chat message from channel.
but I used user_read in scope.
So, I want what to do authentication via twitch. And the accessToken want to use to take chat message.
Is this possible? or Is take each accessToken ?

use the username “justinfan12345” no password.

That will let you login to and read from chat.

Or you must request the chat_login scope

Sorry. I didn’t understand.

Can use Only username? (not use password?)

I testing source below.(There is this source in Get started with Twitch development)
window.chatClient = new chatClient({
channel: ‘#CHANNELNAMEHERE’,
username: ‘USERNAMEHERE’,
password: ‘oauth:AUTHTOKENHERE’, <- Not use?
});

Justinfan anonomous login requires a blank password (I think anything works but blank is best)

Is this correct?
window.chatClient = new chatClient({
channel: ‘#xxxxxxxxxx’,
username: ‘pororia79’,
password: ’ ',
});

No you would need a chat_login scope oauth for user pororia79

The anonomous login is justinfanSTRINGOFNUMBERS

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.