[REQUEST] Spotify API

I want to use Spotify API in Kodular. What I want to do for now are the basic features at a usable level. For example;

For only Album and Song;

  • Cover photo.
  • Get album and playlist.
  • Playing Related Music.
  • Get lyrics.

The ones on this list are enough for me.

Additionally, I can only pay in NEAR. Paypal is not used in my country.

The web API Web API | Spotify for Developers is a RESTful APi, which means, you could use the web component to connect… no extension required…

Taifun

Based on the Web-Api documentation, I’ve come this far, but I’ve done all of this using node.js.(app.js And index.html) How can I make a js+Html link with the web component? or i have set up an album list / how should i use web join to play a music?
image

For example I don’t know how to run this api request using web component.

Set the url and use the Get method to receive the result in the GotText event
Taifun

I think you misunderstood me. In order to receive data from this api request, it is necessary to create an Outh2 record.
image

Without entering this information, it will not yield any results. When you try the sample api request I gave above, the response will be as follows;

image

That’s the real problem. I opened this topic as I couldn’t find a way to introduce the api information and implement the requests.

Yes, first you will have to follow the authorization workflow to get an access token

Taifun

Yes. It is necessary to have intermediate javascript knowledge in order to perform authorization procedures.

1 Like

No,it is not necessary, you can use for everything the web component

Authentication

All requests to Web API require authentication. This is achieved by sending a valid OAuth access token in the request header. For more information about these authentication methods, see the Web API Authorization Guide.

Taifun

Thanks to this sentence, I have read most of the relevant documents and after examining the project that @Jaxparrow shared on Github in detail, I can now use API requests. It took some time but I still have no idea how to use these requests in web component.

Currently, javascript is needed to get results from an API query. There is no block to run the .js extension in the web component. I need a block running javascript to be able to do OAuth. The “CustomWebView” extension might work for me, but it’s just too advanced for querying javascript.

If there is a way to run javascript with the web component, could you share it with me?

1 Like

why do you think, JavaScript is needed? It is not…
Taifun

I’ve gone through the documentation again, but I don’t understand what you mean. To use Web Api, OAuth approval is required. All the examples made on this subject are getting results using javascript.

In addition, queries can be made using CURL, but the token time given for use is limited. It needs to be constantly updated. I think there is something I can’t see or understand. How can I use Web Api without using JavaScript?

1 Like

see here Authorization Code Flow | Spotify for Developers

JavaScript is only an example, what you have to do is

Request User Authorization

The first step is to request authorization from the user, so our app can access to the Spotify resources in behalf that user. To do so, our application must build and send a GET request to the /authorize endpoint with the following parameters: (See details there)

Taifun

I think you are talking about such a query.

htps://accounts.spotify.com/authorize?client_id=${Client_id}&response_type=token&scope=playlist-modify-public&redirect_uri=$https://localhost:8080/callback

How can I handle this security issue? These codes are not too hard to find when I create an apk using this system.

You can use the obfuscate block from the text drawer to obfuscate sensitive data like the client id

Taifun

1 Like

Thank you for all the information you have provided.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.