func GetClaims(idToken string) (*jwt.Claims, error) {
	j, err := jwt.Decode(idToken)
	if err != nil {
		return nil, err
	}
	claim := j.Claims()
	return &claim, nil
}
GetClaims decodes the id_token response and returns the JWT claims to identify the user
package apple
import (
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"strings"
	"time"
	"github.com/tideland/gorest/jwt"
)
const (
	ValidationURL string = "https://appleid.apple.com/auth/token"
	ContentType string = "application/x-www-form-urlencoded"
	UserAgent string = "go-signin-with-apple"
	AcceptHeader string = "application/json"
)
type ValidationClient interface {
	VerifyWebToken(ctx context.Context, reqBody WebValidationTokenRequest, result interface{}) error
	VerifyAppToken(ctx context.Context, reqBody AppValidationTokenRequest, result interface{}) error
	VerifyRefreshToken(ctx context.Context, reqBody ValidationRefreshRequest, result interface{}) error
}
type Client struct {
	validationURL string
	client        *http.Client
}
func New() *Client {
	client := &Client{
		validationURL: ValidationURL,
		client: &http.Client{
			Timeout: 5 * time.Second,
		},
	}
	return client
}
func NewWithURL(url string) *Client {
	client := &Client{
		validationURL: url,
		client: &http.Client{
			Timeout: 5 * time.Second,
		},
	}
	return client
}
func (c *Client) VerifyWebToken(ctx context.Context, reqBody WebValidationTokenRequest, result interface{}) error {
	data := url.Values{}
	data.Set("client_id", reqBody.ClientID)
	data.Set("client_secret", reqBody.ClientSecret)
	data.Set("code", reqBody.Code)
	data.Set("redirect_uri", reqBody.RedirectURI)
	data.Set("grant_type", "authorization_code")
	return doRequest(ctx, c.client, &result, c.validationURL, data)
}
func (c *Client) VerifyAppToken(ctx context.Context, reqBody AppValidationTokenRequest, result interface{}) error {
	data := url.Values{}
	data.Set("client_id", reqBody.ClientID)
	data.Set("client_secret", reqBody.ClientSecret)
	data.Set("code", reqBody.Code)
	data.Set("grant_type", "authorization_code")
	return doRequest(ctx, c.client, &result, c.validationURL, data)
}
func (c *Client) VerifyRefreshToken(ctx context.Context, reqBody ValidationRefreshRequest, result interface{}) error {
	data := url.Values{}
	data.Set("client_id", reqBody.ClientID)
	data.Set("client_secret", reqBody.ClientSecret)
	data.Set("refresh_token", reqBody.RefreshToken)
	data.Set("grant_type", "refresh_token")
	return doRequest(ctx, c.client, &result, c.validationURL, data)
}
func GetUniqueID(idToken string) (string, error) {
	j, err := jwt.Decode(idToken)
	if err != nil {
		return "", err
	}
	return fmt.Sprintf("%v", j.Claims()["sub"]), nil
}