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

[Feature] RefreshToken usage #565

Open
SayHelloGsx opened this issue Jul 23, 2024 · 9 comments
Open

[Feature] RefreshToken usage #565

SayHelloGsx opened this issue Jul 23, 2024 · 9 comments
Labels
feature request New feature or request

Comments

@SayHelloGsx
Copy link

Describe the feature

Hi, I saw a refreshToken returned from the API /v1/user-service/user/login. Is there an API that can use refreshToken to refresh accessToken

What device is this for?

X1C

Other Information

No response

@SayHelloGsx SayHelloGsx added the feature request New feature or request label Jul 23, 2024
Copy link

Stale issue message

@AdrianGarside
Copy link
Collaborator

AdrianGarside commented Oct 22, 2024

There will be but I don't know what it is. The tokens don't expire for a long time (a year) so the lack of this isn't too impactful.

@AdrianGarside
Copy link
Collaborator

@t0nyz0 I don't suppose you came across the REST api for using refreshTokens to regenerate an authToken later?

@t0nyz0
Copy link

t0nyz0 commented Nov 5, 2024

@AdrianGarside Ah yes, almost forgot we need to refresh the token. I'll look into it.

@AdrianGarside
Copy link
Collaborator

AdrianGarside commented Nov 5, 2024

They currently last a year so it's not super urgent but it would be nice to gracefully handle extending it, but might be tricky to test.

@AdrianGarside
Copy link
Collaborator

/v1/user-service/user/refreshtoken is the API although apparently it's behavior just changed so it no longer works when passed previously valid data.

@t0nyz0
Copy link

t0nyz0 commented Nov 18, 2024

@AdrianGarside I took some vacation time but I'm glad you got things figured out. I burned a few hours today discovering that they require https://api.bambulab.com/v1/user-service/user/login for the initial login request instead of https://bambulab.com/api/sign-in/form. I should have been paying attention to your updates. I plan on working on the refreshToken code next unless you crack it first.

@drndos
Copy link

drndos commented Dec 12, 2024

Consider logging in through cloud then GET https://api.bambulab.com/v1/iot-service/api/user/bind and use that access code for local connection. For me it works and no refresh token is necessary

@AdrianGarside
Copy link
Collaborator

The integration already supports connecting to the printer locally with an access code retrieved from the cloud APIs. That's fine if you only want to do so and can live with the limitations that has (Bambu blocks certain controls of the printer via local mqtt unless the printer is in full lan mode). But after a year when the authentication token expires you will lose some features because they are solely supported by the cloud APIs (e.g. custom filaments, print images, filament usage data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants