ExtractKiteID extracts kite ID from the raw JWT token.
(token string)
| 166 | |
| 167 | // ExtractKiteID extracts kite ID from the raw JWT token. |
| 168 | func ExtractKiteID(token string) (string, error) { |
| 169 | te := &TokenExtractor{} |
| 170 | |
| 171 | _, err := jwt.Parse(token, te.Extract) |
| 172 | |
| 173 | if e, ok := err.(*jwt.ValidationError); ok && e.Error() == errTokenExtractor.Error() { |
| 174 | return te.KiteID, nil |
| 175 | } |
| 176 | |
| 177 | return "", err |
| 178 | } |