Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.myForm={};
- $scope.loginData = function(){
- $scope.userName = $scope.myForm.firstName;
- $scope.password = $scope.myForm.lastName ;
- var ClientOAuth2 = require('client-oauth2');
- var githubAuth = new ClientOAuth2({
- clientId: 'sWm1ckF8pEjjPXsF6T0TaEY5E4Aa',
- clientSecret: 'LtfWCxqaEqvavbjFUzeLlq2FbMMa',
- accessTokenUri: 'https://10.37.3.24:8243/token',
- authorizationUri: ': http://10.37.3.24:8280/devicegateway/v1/getuser/admin',
- redirectUri: 'http://tutorials.jenkov.com/angularjs/forms.html',
- scopes: ['notifications', 'gist']
- });
- var token = githubAuth.createToken('access token', 'optional refresh token', 'optional token type', { data: 'raw user data' });
- // Set the token TTL.
- token.expiresIn(1234); // Seconds.
- token.expiresIn(new Date('2016-03-13')) ;// Date.
- // Refresh the users credentials and save the new access token and info.
- token.refresh().then(storeNewToken);
- // Sign a standard HTTP request object, updating the URL with the access token
- // or adding authorization headers, depending on token type.
- token.sign({
- method: 'get',
- url: 'https://api.github.com/users'
- }) //=> { method, url, headers, ... }
- githubAuth.owner.getToken($scope.myForm.firstName, $scope.myForm.lastName)
- .then(function (user) {
- console.log(user) //=> { accessToken: '...', tokenType: 'bearer', ... }
- });
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement