Porsche: remove secondary identity
This commit is contained in:
parent
06d33c1c51
commit
0ad95ee6bb
3 changed files with 10 additions and 24 deletions
|
|
@ -65,13 +65,7 @@ func NewPorscheFromConfig(other map[string]interface{}) (api.Vehicle, error) {
|
|||
return nil, errors.New("vehicle is not paired with the My Porsche account")
|
||||
}
|
||||
|
||||
// get eMobility capabilities
|
||||
emobIdentity := porsche.NewIdentity(log)
|
||||
if err := emobIdentity.Login(porsche.EmobilityOAuth2Config, cc.User, cc.Password); err != nil {
|
||||
return nil, fmt.Errorf("emobility login failed: %w", err)
|
||||
}
|
||||
|
||||
emobApi := porsche.NewEmobilityAPI(log, emobIdentity)
|
||||
emobApi := porsche.NewEmobilityAPI(log, identity)
|
||||
capabilities, err := emobApi.Capabilities(cc.VIN)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func NewEmobilityAPI(log *util.Logger, identity oauth2.TokenSource) *EmobilityAP
|
|||
Base: v.Client.Transport,
|
||||
},
|
||||
Decorator: transport.DecorateHeaders(map[string]string{
|
||||
"apikey": EmobilityOAuth2Config.ClientID,
|
||||
"apikey": ClientID,
|
||||
}),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,28 +20,20 @@ import (
|
|||
|
||||
const (
|
||||
OAuthURI = "https://identity.porsche.com"
|
||||
ClientID = "UYsK00My6bCqJdbQhTQ0PbWmcSdIAMig"
|
||||
)
|
||||
|
||||
// https://identity.porsche.com/.well-known/openid-configuration
|
||||
var (
|
||||
endpoint = oauth2.Endpoint{
|
||||
AuthURL: OAuthURI + "/authorize",
|
||||
TokenURL: OAuthURI + "/oauth/token",
|
||||
AuthStyle: oauth2.AuthStyleInParams,
|
||||
}
|
||||
|
||||
OAuth2Config = &oauth2.Config{
|
||||
ClientID: "UYsK00My6bCqJdbQhTQ0PbWmcSdIAMig",
|
||||
ClientID: ClientID,
|
||||
RedirectURL: "https://my.porsche.com/",
|
||||
Endpoint: endpoint,
|
||||
Scopes: []string{"openid", "offline_access"},
|
||||
}
|
||||
|
||||
EmobilityOAuth2Config = &oauth2.Config{
|
||||
ClientID: OAuth2Config.ClientID,
|
||||
RedirectURL: "https://my.porsche.com/myservices/auth/auth.html",
|
||||
Endpoint: endpoint,
|
||||
Scopes: []string{"openid", "offline_access"},
|
||||
Endpoint: oauth2.Endpoint{
|
||||
AuthURL: OAuthURI + "/authorize",
|
||||
TokenURL: OAuthURI + "/oauth/token",
|
||||
AuthStyle: oauth2.AuthStyleInParams,
|
||||
},
|
||||
Scopes: []string{"openid", "offline_access"},
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue