oauthgoapple

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateClientSecret

func GenerateClientSecret(teamID, clientID, keyID string, privateKeyPEM []byte) (string, error)

GenerateClientSecret generates a JWT client secret for Apple OAuth2

func GetUserInfo

func GetUserInfo() http.HandlerFunc

GetUserInfo extracts and decodes Apple id_token from the Authorization header (Bearer id_token) and returns user info.

func GetUserInfoEndpoint

func GetUserInfoEndpoint() string

GetUserInfoEndpoint is unsupported for Apple since user info is only in the ID Token. Instead, decode the ID Token (JWT) to extract user claims.

func LoadPrivateKey

func LoadPrivateKey(path string) ([]byte, error)

LoadPrivateKey loads the private key from a .p8 file

func NewWithOptions

func NewWithOptions(providerConfig *oauthgotypes.ProviderConfig) (coreprov.OAuthO2IDCProvider, error)

NewWithOptions creates a new Apple OAuth2/OIDC provider with defaults

Types

type AppleIDClaims

type AppleIDClaims struct {
	Email         string `json:"email"`
	EmailVerified string `json:"email_verified"`
	AuthTime      int64  `json:"auth_time"`
	Nonce         string `json:"nonce"`
	jwt.RegisteredClaims
}

AppleIDClaims represents the ID token claims returned by Apple

func ParseIDToken

func ParseIDToken(idToken string) (*AppleIDClaims, error)

ParseIDToken decodes Apple's id_token without signature verification (Apple publishes JWKS, but often decoding for profile is enough).

type AppleUserResponse

type AppleUserResponse struct {
	Sub           string `json:"sub"`
	Email         string `json:"email"`
	EmailVerified string `json:"email_verified"`
	Nonce         string `json:"nonce,omitempty"`
	AuthTime      int64  `json:"auth_time,omitempty"`
}

AppleUserResponse wraps the decoded ID Token claims for Apple users

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL