Advertisement
Guest User

Untitled

a guest
Jul 31st, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. /o/oauth2/token?grant_type=authorization_code&code=4%2F42sz3xxq4wGF9k9joYxRVop9mHi6.UpFaIUqZ_UQaaDn_6y0ZQNh869DgiwI&client_id=199079322117.apps.googleusercontent.com&client_secret=...&redirect_uri=...
  2.  
  3. Yeah I know its a very old question but I faced the same problem today.
  4. and resolved the issue as follow.
  5. if you use form option it will automatically set content type
  6. appticationx-ww-orm-urtencoded
  7.  
  8.  
  9.  
  10. var request = require('request');
  11. request.post('https://accounts.google.com/o/oauth2/token',
  12. {
  13. form: {
  14. code: '4/M9YCOpJkweTzLKbkoDSj1JiCtFGp.otpz-eXAviMZgrKXntQAax12uvgYjwI',
  15. client_secret: 'BpQ-5ck5rpD0ixFmGYsEP998',
  16. client_id: '256393709562-l4idip7eh234kulhcfo6i7shcqmvnd7v.apps.googleusercontent.com',
  17. grant_type: 'authorization_code',
  18. redirect_uri: 'https://developers.google.com/oauthplayground'
  19. }
  20. },function(err,res,body){
  21. console.log(body);
  22. if(err) console.log(err);
  23. //console.log(res);
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement