I’m currently trying on integrating the Spotify API to create a playlist management dashboard.
After we login through Spotify, how can I obtain the OAuth2 access token? I already try different way, such as accessing frappe.session, but still doesn’t know how to get the access token and the refresh token, I need this token to interact with the Spotify API, such as creating playlists and managing user data, and creating their Virtual Doctype. is there any way without customizing the oauth2 code?
# First call or call when no valid token is found
app = frappe.get_doc("Connected App", "abcd")
app.initiate_web_application_flow()
# once token is in cache
token = app.get_active_token() # for frappe.session.user
token = app.get_active_token("user@example.com") # for user@example.com
This is works but my access_token become like this
‘access_token’: ‘*******************************************************************************************************************************************************************************************************************’
When I use this token in my request, it results in the following error:
{‘error’: 400, ‘message’: ‘Only valid bearer authentication supported’}