Hyundai: fix login error by updating brand auth url

This commit is contained in:
andig 2021-11-08 16:00:48 +01:00
parent 69d97169b7
commit 4c8a4d56ca
4 changed files with 7 additions and 4 deletions

View file

@ -21,7 +21,7 @@ const (
resOK = "S" // auth fail: F
timeFormat = "20060102150405 -0700" // Note: must add timeOffset
timeOffset = " +0100"
refreshTimeout = time.Minute
refreshTimeout = 2 * time.Minute
statusExpiry = 5 * time.Minute
)

View file

@ -29,6 +29,7 @@ const (
// Config is the bluelink API configuration
type Config struct {
URI string
AuthClientID string // v2
BrandAuthUrl string // v2
BasicToken string
CCSPServiceID string
@ -150,7 +151,7 @@ func (v *Identity) brandLogin(cookieClient *request.Helper, user, password strin
var resp *http.Response
if err == nil {
uri := fmt.Sprintf(v.config.BrandAuthUrl, v.config.URI, "en", info.ServiceId, info.UserId)
uri := fmt.Sprintf(v.config.BrandAuthUrl, v.config.AuthClientID, v.config.URI, "en", info.ServiceId, info.UserId)
req, err = request.New(http.MethodGet, uri, nil)
if err == nil {

View file

@ -47,7 +47,8 @@ func NewHyundaiFromConfig(other map[string]interface{}) (api.Vehicle, error) {
BasicToken: "NmQ0NzdjMzgtM2NhNC00Y2YzLTk1NTctMmExOTI5YTk0NjU0OktVeTQ5WHhQekxwTHVvSzB4aEJDNzdXNlZYaG10UVI5aVFobUlGampvWTRJcHhzVg==",
CCSPServiceID: "6d477c38-3ca4-4cf3-9557-2a1929a94654",
CCSPApplicationID: bluelink.HyundaiAppID,
BrandAuthUrl: "https://eu-account.hyundai.com/auth/realms/euhyundaiidm/protocol/openid-connect/auth?client_id=97516a3c-2060-48b4-98cd-8e7dcd3c47b2&scope=openid%%20profile%%20email%%20phone&response_type=code&hkid_session_reset=true&redirect_uri=%s/api/v1/user/integration/redirect/login&ui_locales=%s&state=%s:%s",
AuthClientID: "64621b96-0f0d-11ec-82a8-0242ac130003",
BrandAuthUrl: "https://eu-account.hyundai.com/auth/realms/euhyundaiidm/protocol/openid-connect/auth?client_id=%s&scope=openid%%20profile%%20email%%20phone&response_type=code&hkid_session_reset=true&redirect_uri=%s/api/v1/user/integration/redirect/login&ui_locales=%s&state=%s:%s",
}
identity, err := bluelink.NewIdentity(log, settings)

View file

@ -47,7 +47,8 @@ func NewKiaFromConfig(other map[string]interface{}) (api.Vehicle, error) {
BasicToken: "ZmRjODVjMDAtMGEyZi00YzY0LWJjYjQtMmNmYjE1MDA3MzBhOnNlY3JldA==",
CCSPServiceID: "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a",
CCSPApplicationID: bluelink.KiaAppID,
BrandAuthUrl: "https://eu-account.kia.com/auth/realms/eukiaidm/protocol/openid-connect/auth?client_id=572e0304-5f8d-4b4c-9dd5-41aa84eed160&scope=openid%%20profile%%20email%%20phone&response_type=code&hkid_session_reset=true&redirect_uri=%s/api/v1/user/integration/redirect/login&ui_locales=%s&state=%s:%s",
AuthClientID: "572e0304-5f8d-4b4c-9dd5-41aa84eed160",
BrandAuthUrl: "https://eu-account.kia.com/auth/realms/eukiaidm/protocol/openid-connect/auth?client_id=%s&scope=openid%%20profile%%20email%%20phone&response_type=code&hkid_session_reset=true&redirect_uri=%s/api/v1/user/integration/redirect/login&ui_locales=%s&state=%s:%s",
}
identity, err := bluelink.NewIdentity(log, settings)