144 size_t inBytes, outBytes;
146 char *key, *outData, inData[1024];
150 if (!strncmp(b64data,
"Bearer%20", 9)) b64data += 9;
156 if (!(dot = index(b64data,
'.')))
return false;
161 inBytes = dot - b64data;
162 if (inBytes >= (
int)
sizeof(inData))
return false;
163 memcpy(inData, b64data, inBytes);
168 outBytes = DecodeBytesNeeded(inBytes);
169 outData = (
char *)alloca(outBytes);
173 if (DecodeUrl(inData, inBytes, outData, outBytes))
return false;
178 if (outBytes <= 0 || *outData !=
'{' || outData[outBytes-1] !=
'}')
183 if (!(key = strstr(outData,
"\"typ\"")))
return false;
188 while(*key ==
' ') key++;
189 if (*key !=
':')
return false;
194 while(*key ==
' ') key++;
195 return strncmp(key,
"\"JWT\"", 5) == 0;