Documentation
¶
Index ¶
Constants ¶
View Source
const ( LineOAuthURL = "https://access.line.me/oauth2/v2.1/authorize" LineTokenURL = "https://api.line.me/oauth2/v2.1/token" LineVerifyTokenURL = "https://api.line.me/oauth2/v2.1/verify" )
Variables ¶
This section is empty.
Functions ¶
func NewLineOAuth ¶
func NewLineOAuth(inputConfig *LineOAuthConfig) *lineOAuthReceiverArgument
Types ¶
type LineIDTokenInfoResponse ¶
type LineIDTokenInfoResponse struct {
// Issuer should be https://access.line.me
Iss string `json:"iss"`
// User ID
Sub string `json:"sub"`
// Channel ID
Aud string `json:"aud"`
// The expiry date of the ID token in UNIX time.
Exp int64 `json:"exp"`
// The time the ID token was issued in UNIX time.
Iat int64 `json:"iat"`
// Time when the user was authenticated in UNIX time. Not included if the max_age parameter wasn't specified in the authorization request.
AuthTime *int64 `json:"auth_time"`
// The nonce value specified in the authorization request. This claim is returned only if a nonce value is specified in the authorization request.
Nonce *string `json:"nonce"`
// User authentication method. The following values are possible: pwd, lineautologin, lineqr, and linesso.
Amr []string `json:"amr"`
// User's display name (only returned if the `profile` scope is specified)
Name *string `json:"name"`
// User's profile image URL (only returned if the `profile` scope is specified)
Picture *string `json:"picture"`
// User's email address (only returned if the `email` scope is specified)
Email *string `json:"email"`
}
type LineOAuthConfig ¶
type LineOAuthMethod ¶
type LineOAuthMethod interface {
// GenerateOAuthURL is a function to generate oauth url for user to login
GenerateOAuthURL(option OptionLineGenerateOAuthURL) (oauthURL string)
// GetAccessToken is a function to get user access token by code that response from google
GetToken(code string) (tokenData LineTokenResponse, err error)
// GetIDTokenInfo is a function to get id token info from line server
GetIDTokenInfo(idToken string) (idTokenInfo LineIDTokenInfoResponse, err error)
}
type LineTokenInfoRequest ¶
type LineTokenRequest ¶
type LineTokenResponse ¶
type LineTokenResponse struct {
// Access token. Valid for 30 days.
AccessToken string `json:"access_token"`
// Expiration time of access token (in seconds).
ExpiresIn int64 `json:"expires_in"`
IDToken string `json:"id_token"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
TokenType string `json:"token_type"`
}
type OptionLineGenerateOAuthURL ¶
type OptionLineGenerateOAuthURL struct {
// Valid values: `openid`, `profile`, `email`
Scopes []string
// A unique alphanumeric string used to prevent cross-site request forgery attacks. This value is returned in the ID token.
State string
// A string used to prevent replay attacks (opens new window). This value is returned in an ID token.
Nonce string
// Set to `consent` to force the consent screen to appear even if the user has already granted all requested permissions.
Prompt string
// The max_age request parameter prevents the user from being auto-logged in using cookies.
MaxAge int64
// Display language for LINE Login screens ex. en-US.
UiLocales string
// Displays an option to add a LINE Official Account as a friend during login. Set to either `normal` or `aggressive`
BotPrompt string
// Set to `lineqr` to display the QR code on the login screen by default.
InitialAmrDisplay string
// Set to `true` to hide the buttons for changing the login method, such as "Log in with email" or "QR code login".
SwitchAmr bool
// If set to `true`, Auto login will be disabled. The default value is false.
DisableAutoLogin bool
// If set to `true`, Auto login will be disabled in iOS. The default value is false.
DisableIosAutoLogin bool
CodeChallenge string
CodeChallengeMethod string
}
Click to show internal directories.
Click to hide internal directories.