How get "OAuth Token" Twitch and Mixer?

Hi Support,

we are implementing a new site for games www.mvp-arena.com in PHP language and we have decided to use your fantastic plugin.
However, we need to further integrate the functionality of the Twitch and Mixer socials platforms.
For this reason, we need to retrieve the authentication "OAuth Token" after user login so that we can use it in the API calls of the Twitch and Mixer social platforms.
Is there any way to get this information using your wordpress plugin?

Thanks in advance

MVP-Arena Team

Answers

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team

    Hello,

    yes after the login with a social network the full data is retrieved here:
    https://github.com/oneall/social-login-wordpress/blob/wordpress/3.0-5.0+/upload/oa-social-login/includes/communication.php#L44

    You could use this hook to store the data:
    http://docs.oneall.com/plugins/guide/social-login-wordpress/#3a

    Here a an example (untested):

    function oa_social_login_store_extended_data ($user_data, $identity)
    {
        if ($identity->provider == 'twitch')
        {
            update_user_meta ($user_data->ID, 'access_token', $identity->source->access_token_key);
        }
    }
    
    //This action is called whenever Social Login adds a new user
    add_action ('oa_social_login_action_after_user_insert', 'oa_social_login_store_extended_data', 10, 2);
    
  • To get an OAuth token for Twitch, first, register your application on the https://dev.twitch.tv/console by logging in, clicking "Applications," and filling out the necessary details like Name, OAuth Redirect URLs, and Category. After creating the application, you'll receive a Client ID and Client Secret.

    For Mixer (now known as Facebook Gaming), visit the Facebook for Developers site to register your application. Log in, create a new app, and complete the setup process. You'll then be provided with an App ID and App Secret. Use these credentials to follow the OAuth flow for obtaining an access token for authentication and accessing the platform's API.

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.