code: func NewToken(rawToken string) (*Token, error) {
  	parts := strings.Split(rawToken, TokenSeparator)
  	if len(parts) != 3 {
  		return nil, ErrMalformedToken
  	}
  
  	var (
  		rawHeader, rawClaims   = parts[0], parts[1]
  		headerJSON, claimsJSON []byte
  		err                    error
  	)
  
  	defer func() {
  		if err != nil {
  			log.Infof("error while unmarshalling raw token: %s", err)
  		}
  	}()
  
  	if headerJSON, err = joseBase64UrlDecode(rawHeader); err != nil {
  		err = fmt.Errorf("unable to decode header: %s", err)
  		return nil, ErrMalformedToken
  	}
  
  	if claimsJSON, err = joseBase64UrlDecode(rawClaims); err != nil {
  		err = fmt.Errorf("unable to decode claims: %s", err)
  		return nil, ErrMalformedToken
  	}
  
  	token := new(Token)
  	token.Header = new(Header)
  	token.Claims = new(ClaimSet)
  
  	token.Raw = strings.Join(parts[:2], TokenSeparator)
  	if token.Signature, err = joseBase64UrlDecode(parts[2]); err != nil {
  		err = fmt.Errorf("unable to decode signature: %s", err)
  		return nil, ErrMalformedToken
  	}
  
  	if err = json.Unmarshal(headerJSON, token.Header); err != nil {
  		return nil, ErrMalformedToken
  	}
  
  	if err = json.Unmarshal(claimsJSON, token.Claims); err != nil {
  		return nil, ErrMalformedToken
  	}
  
  	return token, nil
  }
docs: // NewToken parses the given raw token string
  // and constructs an unverified JSON Web Token.