Hi everyone,
i'm trying to get access to amazon music using its API. To use it, I've created an API Key in Amazon Developer concole. Following the API instructions I have to use Login For Amazon to authenticate my user name and password and i must pass the API Key.
My questions:
1. How can I add the API Key to my project descriped here in B4A? Where is the assets folder located?
2. How can I use OkHttpUtils2 to login and get the SecurityToken which is needed to get access to Amazon Music?
Thanks in advance.
Here is my code so far (the functions to get the SecurityToken and the login are currently empty):
i'm trying to get access to amazon music using its API. To use it, I've created an API Key in Amazon Developer concole. Following the API instructions I have to use Login For Amazon to authenticate my user name and password and i must pass the API Key.
My questions:
1. How can I add the API Key to my project descriped here in B4A? Where is the assets folder located?
2. How can I use OkHttpUtils2 to login and get the SecurityToken which is needed to get access to Amazon Music?
Thanks in advance.
Here is my code so far (the functions to get the SecurityToken and the login are currently empty):
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private SecurityToken As String
Private WV_Error As WebView
Private PNL_Main As Panel
Private PNL_Footer As Panel
Private PNL_Header As Panel
End Sub
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
If SecurityToken.Length = 0 Then
Wait For(GetSecurityToken) Complete (Result As Boolean)
Wait For(Login(SecurityToken)) Complete (Result As Boolean)
Else
Wait For(Login(SecurityToken)) Complete (Result As Boolean)
If Result = True Then
Root.LoadLayout("MainPage")
Private Job As HttpJob
Job.Initialize("", Me)
Job.GetRequest.SetContentType("application/json")
Job.Download("https://music-api.amazon.com/search/?keywords=hello")
Wait For (Job) JobDone(Job As HttpJob)
Else
ToastMessageShow("Fehler beim Login", True)
End If
End If
End Sub
Private Sub JobDone(Job As HttpJob)
Dim Response As String
If Job.Success Then
Response = Job.GetString
Else
Response = Job.ErrorMessage
End If
Job.Release
If WV_Error.IsInitialized Then
WV_Error.RemoveView
Else
WV_Error.Initialize("")
Root.AddView(WV_Error, 0, 0, Root.Width, Root.Height)
End If
WV_Error.LoadHtml(Response)
End Sub
Private Sub GetSecurityToken As ResumableSub
End Sub
Private Sub Login(SecToken As String) As ResumableSub
End Sub