Skip to content

Correct use of refresh token #677

Closed Answered by rikroe
SionS4R asked this question in Q&A
Discussion options

You must be logged in to vote

Some basics:

  • bearer_token (the token used for connecting to the API and you get after login) is valid for 1 hour
  • refresh_token can be used to get a new bearer_token for another hour (and you get a new refresh token). the refresh_token can only be used once

As long as the MyBMWAccount object is in Python memory, you don't have to worry, as the library will take care of it.

If for some reason (e.g. because you restarted your script) the refresh_token is not available anymore, you will need to use another login with captcha.

The alternative is saving this data to a file and loading from it before trying to set up. You can find some inspiration in the CLI module, with args.oauth_store is a p…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rikroe
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants