Skip to content

Instantly share code, notes, and snippets.

@CBenni
Created February 20, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CBenni/80db7b50df4a31563b69f2f59e024592 to your computer and use it in GitHub Desktop.
Save CBenni/80db7b50df4a31563b69f2f59e024592 to your computer and use it in GitHub Desktop.
Blank Pen (External JS/CSS)
<body layout="row" ng-app="myApp" ng-cloak>
</body>
angular.module('myApp',['ngMaterial'])
.controller("c", function($scope) {
$scope.client_id = "m4fyzznv5j844d8q3plttncoxm2px6";
$scope.redirect_uri = "https://cbenni.com/oauthgen/redirect";
$scope.scopes = ["user_read","user_blocks_edit","user_blocks_read","user_follows_edit","channel_read","channel_editor","channel_commercial","channel_stream","channel_subscriptions","user_subscriptions","channel_check_subscription","chat_login","channel_feed_read","channel_feed_edit"]
$scope.selectedscopes = {};
$scope.getAuthUrl = function(){
var selscopes = [];
for(var i=0;i<$scope.scopes.length;++i) {
if($scope.selectedscopes[$scope.scopes[i]]) selscopes.push($scope.scopes[i]);
}
return "https://api.twitch.tv/kraken/oauth2/authorize"
+"?response_type=token"
+"&client_id="+$scope.client_id
+"&redirect_uri="+encodeURIComponent($scope.redirect_uri)
+"&scope="+selscopes.join("+");
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script>
<link href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment