Fix your "getting started" guide.
This is a horrible getting started page. The authentication manager example does not actually do any connecting. There's nothing to initially trigger the login. Per the comment in the "logged out" status, adding a call to GetAuthInformation() then changes the status to "Loading" which isn't even mentioned. Nothing happens from there. Making a call to GetAuthenticationInfo() gives a MaybeResult that's null. Nothing further can happen. There's also an undeclared variable "RequiredScopes" there. This whole guide is an epic fail.
-
b00mzer
commented
On unity I solved the problem
const float REFRESH_SECOND = 1;
readonly TwitchOAuthScope[] SCOPES = new TwitchOAuthScope[] {
TwitchOAuthScope.Bits.Read,
TwitchOAuthScope.Channel.ManageBroadcast,
TwitchOAuthScope.Channel.ManagePolls,
TwitchOAuthScope.Channel.ManageRedemptions,
TwitchOAuthScope.Channel.ReadHypeTrain,
TwitchOAuthScope.Channel.ManagePredictions,
TwitchOAuthScope.Clips.Edit,
TwitchOAuthScope.User.ReadSubscriptions};GameTask<AuthenticationInfo> _authInfoTask;
GameTask<AuthState> _curAuthState;/// <summary>
/// Thread for the connection to twitch API
/// </summary>
/// <returns></returns>
private void ConnectionToApplicationAPI()
{
switch (_curAuthState.MaybeResult.Status)
{
case AuthStatus.LoggedIn:
break;case AuthStatus.WaitingForCode:
break;case AuthStatus.LoggedOut:
case AuthStatus.Loading:
//Remake a connection
if (_authInfoTask == null)
_authInfoTask = Twitch.API.GetAuthenticationInfo(SCOPES);StartCoroutine(CheckAuthInfoTask());
break;
}
}/// <summary>
/// Thread to open a web page for logging the user
/// </summary>
/// <returns></returns>
IEnumerator CheckAuthInfoTask ()
{
while (true)
{
switch (_authInfoTask.Task.Status)
{
case TaskStatus.Created:
case TaskStatus.WaitingForActivation:
case TaskStatus.WaitingToRun:
case TaskStatus.Running:
case TaskStatus.WaitingForChildrenToComplete:
case TaskStatus.RanToCompletion:
Application.OpenURL(_authInfoTask.Task.Result.Uri);
yield break;
case TaskStatus.Canceled:
yield break;
case TaskStatus.Faulted:
yield break;
}yield return new WaitForSeconds(REFRESH_SECOND);
}
} -
alijaya
commented
Yep, it's really bad. I should change several things to get it working.
And I've just realized that the API is incomplete :')
-
arminanderson
commented
Yeah, its really bad