Guest User

Untitled

a guest
Feb 23rd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. function initClient() {
  2. window.gapi.client.init(googleCalendarConfig)
  3. .then(_ => {
  4. console.log('init ok')
  5. })
  6. .catch(error => {
  7. dispatch('authenticationError', {error, note: 'Error on GAPI init.'})
  8. })
  9. }
  10. window.gapi.load('client', initClient)
  11.  
  12. googleyolo.retrieve(oneTapConfig)
  13. .then(credential => {
  14. console.log('credential → ', credential)
  15. let token = {access_token: credential.idToken}
  16. window.gapi.client.setToken(token)
  17. })
  18.  
  19. gapi.client.calendar.events.list({
  20. calendarId: "primary",
  21. timeMin: new Date().toISOString(),
  22. showDeleted: false,
  23. singleEvents: true,
  24. maxResults: 10,
  25. orderBy: "startTime"
  26. })
  27.  
  28. {
  29. "error": {
  30. "errors": [
  31. {
  32. "domain": "global",
  33. "reason": "authError",
  34. "message": "Invalid Credentials",
  35. "locationType": "header",
  36. "location": "Authorization"
  37. }
  38. ],
  39. "code": 401,
  40. "message": "Invalid Credentials"
  41. }
  42. }
Add Comment
Please, Sign In to add comment