fix callback server not returning anything to the browser, implementing a way to change the content of the success page
This commit is contained in:
10
README.md
10
README.md
@@ -76,18 +76,22 @@ session = Session.Builder() \
|
||||
.create()
|
||||
```
|
||||
|
||||
#### With auth url callback
|
||||
#### With auth url callback and changing the content of the success page
|
||||
|
||||
```python
|
||||
from librespot.core import Session
|
||||
import webbrowser
|
||||
|
||||
# This will pass the auth url to the method
|
||||
|
||||
def auth_url_callback(url):
|
||||
print(url)
|
||||
webbrowser.open(url)
|
||||
|
||||
# This is the response sent to the browser once the flow has been completed successfully
|
||||
success_page = "<html><body><h1>Login Successful</h1><p>You can close this window now.</p><script>setTimeout(() => {window.close()}, 100);</script></body></html>"
|
||||
|
||||
session = Session.Builder() \
|
||||
.oauth(auth_url_callback) \
|
||||
.oauth(auth_url_callback, success_page) \
|
||||
.create()
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user