Add option to authenticate via refresh token #322
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements the option to start an authenticated session via an OIDC/Oauth2 refresh token, in preparation for the homeassistant integration to start storing the refresh tokens, speeding up authentication since we no longer have to do the Oauth2 dance via webforms.
This PR changes the
auth/authorize()
and theconnect()
call in the following ways:email
+password
orrefresh_token
email
+password
, nothing changesrefresh_token
, the token will be used to retrieve a new acces token, granting accessSince the
refresh_token
argument is not the first argument, you can not callMySkoda.connect('tokencontent')
, you now need to specify that you are sending arefresh_token
as argument.Options to authenticate are:
This can be
which is backwards compatible
OR
The result will be the same: The library will connect and authenticate/authorize based on the credentials sent. With the authenticated
MySkoda
object you can perform all other calls next.