Token Not Found error

216 views
Skip to first unread message

Dave K.

unread,
Feb 4, 2014, 5:35:28 PM2/4/14
to google-ap...@googlegroups.com
Jay (or person helping me)

I am getting a Token not found error (see below) when running a bash script.  The error started 10% of the way in to execution.  There 150K accounts I am checking the forwarding on, and at 15k+ I started getting the below error. 

Error: 600: Unknown Error: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Token invalid - Invalid token: Token not found</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Token invalid - Invalid token: Token not found</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Token invalid - Invalid token: Token not found'}

when I remove the OAUTHFILE=oauth.txt-admin$x  from the script and use my own token, the script works fine (But slow). So suspect that there is a issue with the service accounts I am using.  I checked all of the 20 accounts and they are not suspended. I suspect there is something wrong with either the ouath token, were should I start looking & what might be the fastest way to resolve?

I have copied the script I am using below.

-Dave

#!/bin/bash

filetime=$(date +'%Y%m%d')

gam_command(){

  OAUTHFILE=oauth.txt-admin$x python /gam/gam.py user "$email" show forward  >> $filetime\.account.forwarding.raw.data

  }

IFS=,

x=1

while read email _user _org _suspended _admin _create _login ; do

  email=${email//\"/}

  gam_command $email $x &

  ### gam_command2 $email $x &

  while (( $(jobs | wc -l) >= 35 )); do

   sleep 0.2

    jobs > /dev/null

    done

  x=$(($x+1))

  if [ $x -gt 20 ]

  then

    x=1

  fi

done < "$@"

wait

Dave K.

unread,
Feb 5, 2014, 12:40:38 PM2/5/14
to google-ap...@googlegroups.com
So Magically, this is working again with out error.  I suspect that even though I was under the API cap for the ADMIN Sdk on the Cloud.google.com dash board, I may have actually been over.  I had set the project User API limits to 60 per/second/per user originally.   I have changed it to 30 per user per second as a "play it safe"


Feel free to ignore this thread.


Dave
Reply all
Reply to author
Forward
0 new messages