Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seat Cupra: fix login #7133

Merged
merged 2 commits into from Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions vehicle/seat-cupra.go
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util"
"github.com/evcc-io/evcc/util/request"
"github.com/evcc-io/evcc/vehicle/seat"
"github.com/evcc-io/evcc/vehicle/seat/cupra"
"github.com/evcc-io/evcc/vehicle/vag/tokenrefreshservice"
"github.com/evcc-io/evcc/vehicle/vag/vwidentity"
Expand Down Expand Up @@ -52,12 +51,12 @@ func NewCupraFromConfig(other map[string]interface{}) (api.Vehicle, error) {
log := util.NewLogger("cupra").Redact(cc.User, cc.Password, cc.VIN)

// get initial VW identity id_token
q, err := vwidentity.Login(log, seat.AuthParams, cc.User, cc.Password)
q, err := vwidentity.Login(log, cupra.AuthParams, cc.User, cc.Password)
if err != nil {
return nil, err
}

trs := tokenrefreshservice.New(log, seat.TRSParams)
trs := tokenrefreshservice.New(log, cupra.TRSParams)
token, err := trs.Exchange(q)
if err != nil {
return nil, err
Expand Down
19 changes: 15 additions & 4 deletions vehicle/seat/cupra/params.go
Expand Up @@ -2,12 +2,23 @@ package cupra

import "net/url"

// TODO check AuthParam usage (currently using seat)
// const (
// Brand = "VW"
// Country = "ES"

// // Authorization ClientID
// AuthClientID = "9d183b70-d129-424f-9a26-c3778edf95e1"
// )

// Authorization parameters
var AuthParams = url.Values{
"response_type": {"code id_token"},
"client_id": {"3c756d46-f1ba-4d78-9f9a-cff0d5292d51@apps_vw-dilab_com"},
"redirect_uri": {"cupra://oauth-callback"},
"response_type": {"code id_token"}, // token
"client_id": {"30e33736-c537-4c72-ab60-74a7b92cfe83@apps_vw-dilab_com"},
"redirect_uri": {"cupraconnect://identity-kit/login"},
"scope": {"openid profile mbb"}, // cars birthdate nickname address phone
}

// TokenRefreshService parameters
var TRSParams = url.Values{
"brand": {"cupra"},
}