Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

  1. #1
    Membre éprouvé
    Inscrit en
    avril 2008
    Messages
    1 088
    Détails du profil
    Informations forums :
    Inscription : avril 2008
    Messages : 1 088
    Points : 1 220
    Points
    1 220

    Par défaut Httprequete connection spotify - impossible d'envoyer un cookie

    Bonjour à tous

    Après plusieurs semaines de recherches sans succès, je viens demander votre aide pour résoudre le problème auquel je suis confronté.

    Problème :

    Je tente de développer un utilitaire qui me permet d'effectuer une connexion à mon compte spotify et extraire des infos (playlists etc...)
    Pour cela j'utilise l'url de l'api spotify et j'y arrive en utilisant la classe cUrl de Jurassic Pork. Malheureusement les requêtes sont plus lentes et je n'arrive pas à rendre la classe multithread (utilisation de la console?)
    D'autres "concurrents" arrivent à le réaliser correctement. Voici le debug d'une connexion réussie :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    Site: https://accounts.spotify.com/en/login?continue=https://www.spotify.com/int/account/overview/
    Mon compte utilisé est cecilebko et le mot de passe est lavieestbelle
     
    L'envoi du cookie __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE= est manuel
     
    Httpliveheader extension sniffer me montre : le header envoyé, le header en réponse et la source en réponse ci dessous
     
    <-----Sent Headers----->
    GET /en/login?continue=https:%2F%2Fwww.spotify.com%2Fint%2Faccount%2Foverview%2F HTTP/1.0
    Accept: */*
    User-Agent: Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
    Host: accounts.spotify.com
    Pragma: no-cache
    Connection: keep-alive
    Cookie: __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=
     
    <-----Received Headers----->
    HTTP/1.1 200 OK
    Server: nginx
    Date: Mon, 12 Feb 2018 00:36:52 GMT
    Content-Type: text/html;charset=utf-8
    Content-Length: 773
    Connection: keep-alive
    Keep-Alive: timeout=600
    Vary: Accept-Encoding
    Vary: Accept-Encoding
     
    Set-Cookie: csrf_token=AQDR5AX21dDZrF9xd8WavZthHtCVQkbJuHh-SAOBlnuRW3yvAhCzLsGh2T-DQd6aK2dVsDRcilGhOtDlFlJQ;Version=1;Domain=accounts.spotify.com;Path=/;Secure
     
    X-UA-Compatible: IE=edge
    X-Frame-Options: deny
    Content-Security-Policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://app.adjust.com https://itunes.apple.com itms-apps:;
    X-Content-Security-Policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://app.adjust.com https://itunes.apple.com itms-apps:;
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Content-Type-Options: nosniff
    Strict-Transport-Security: max-age=31536000
     
    <-----Received Source----->
    <!DOCTYPE html>
    <html ng-app="accounts" ng-csp>
      <head>
        <meta charset="utf-8">
        <title ng-bind="(title && (title | localize) + ' - ') + 'Spotify'">Spotify</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <base href="/">
        <link href="https://d2d1dxiu3v1f2i.cloudfront.net/a4a5157/css/index.css" media="screen" rel="stylesheet">
     
        <script async defer src="https://www.google.com/recaptcha/api.js"></script>
        <script async defer src="https://d2d1dxiu3v1f2i.cloudfront.net/a4a5157/js/index.js" sp-bootstrap></script>
        <meta ng-non-bindable sp-bootstrap-data='{"country":"ML","useCaptcha":false,"locales":["*"],"BON":["0","0",-226210518]}'>
      </head>
      <body ng-view></body>
    </html>
     
    -----------------------------------------------------------------------------------------------------
     
     
    Ici on récupère le token csrf_token puis on fait une nouvelle requête post via : 
     
    https://accounts.spotify.com/api/login
     
    Httpliveheader extension sniffer me montre : le header envoyé, le header en réponse et la source en réponse ci dessous
     
    <-----Sent Headers----->
    POST /api/login HTTP/1.1
    Accept: */*
    User-Agent: Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
    Host: accounts.spotify.com
    Pragma: no-cache
    Connection: keep-alive
    Connection: keep-alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 151
    Cookie: remember=cecilebko; csrf_token=AQDR5AX21dDZrF9xd8WavZthHtCVQkbJuHh-SAOBlnuRW3yvAhCzLsGh2T-DQd6aK2dVsDRcilGhOtDlFlJQ; Version=1; __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=
    Post Data:
    remember=true&username=cecilebko&password=lavieestbelle&csrf_token=AQDR5AX21dDZrF9xd8WavZthHtCVQkbJuHh-SAOBlnuRW3yvAhCzLsGh2T-DQd6aK2dVsDRcilGhOtDlFlJQ
     
     
    <-----Received Headers----->
    HTTP/1.1 200 OK
    Server: nginx
    Date: Mon, 12 Feb 2018 00:36:52 GMT
    Content-Type: application/json
    Content-Length: 27
    Connection: keep-alive
    Keep-Alive: timeout=600
    Vary: Accept-Encoding
     
    Set-Cookie: sp_ac=AQDYBK74HMu6N-MPD5gbJKT3bsGjg2_H2SpGobBUXxj_dFa3cbaN9qecb7DP1u2CEo8P3-mwOH4-Uk7YoV_waiw3-H25dfudJgQ_56dK7g-f-SL-izck0-C5TcyJ5it2qMWQbosM-kSSW9z5xkQ9-3R9WJF368cjBSYIaAJsH0LJoz-u_vXOxEFrq_aUxRiNCHlOmye_7TM;Version=1;Domain=accounts.spotify.com;Path=/;Secure;HttpOnly
     
     
    Set-Cookie: sp_dc=AQBxlX2VjbPJVgVoMp3-d6pP8cYG_Dk_6QczhFhxMTFynjZvo1_sNu6jrQvKsaiU36Fv9yr4VDL0aD8VhBVUuO6f;Version=1;Domain=spotify.com;Path=/;Max-Age=31536000;Secure;HttpOnly;Expires=Tue, 12 Feb 2019 00:36:52 GMT
     
     
    Set-Cookie: csrf_token=AQCDNNYS5Bf_M4PO9H80GAt-93vVU1QHHI8ABHDr-6HP3jcVpdHwKJo2eEwXYbMrDdn_5fDKSrLgJlsVCq4D;Version=1;Domain=accounts.spotify.com;Path=/;Secure
     
    X-UA-Compatible: IE=edge
    X-Frame-Options: deny
    Content-Security-Policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://app.adjust.com https://itunes.apple.com itms-apps:;
    X-Content-Security-Policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://app.adjust.com https://itunes.apple.com itms-apps:;
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Content-Type-Options: nosniff
    Strict-Transport-Security: max-age=31536000
     
     
     
    <-----Received Source----->
    {"displayName":"cecilebko"}
     
     
    En obtenant dans la source {"displayName":"cecilebko"} je suis donc connecté.
    Lorsque j'effectue les mêmes opérations avec httprequete de windev, j'ai l'impression que le passage de cookie ne fonctionne pas, je n'arrive pas à obtenir le même résultat.

    Voici le code simplifié que j'ai écrit :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    HTTPParamètre(httpParamètreMode,1)
    HTTP.IgnoreErreur = httpIgnoreCertificatExpiré+httpIgnoreCertificatInvalide+httpIgnoreNomCertificatInvalide
    sCookie0 = "__bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE="
    sAdditionalHeader = "Cookie: "+sCookie0
    SI PAS HTTPRequête(sUrl0,sagent,sAdditionalHeader) ALORS
    	info(HErreurInfo(hErrComplet)+RC)
    	FinProgramme()
    FIN
     
    sResultHead = HTTPDonneRésultat(httpEntête)
    sResultSource = HTTPDonneRésultat(httpRésultat)
     
    SI ChaîneOccurrence(sResultHead,"Set-Cookie: csrf_token=",SansCasse)>0 ALORS
    	// l'histoire continue
    	stoken = "csrf_token="+ExtraitChaîne(ExtraitChaîne(sResultHead,1,"Set-Cookie: csrf_token=",DepuisFin),1,";")
    	sPostData = "remember=true&username=%1&password=%2&%3"
    	sPostData = ChaîneConstruit(sPostData,sUser,sPass,stoken)
    	sAdditionalHeader = "Cookie: remember="+sUser+"; "+stoken+"; Version=1; "+sCookie0+RC
     
    	SI PAS HTTPRequête(sUrl,sagent,sAdditionalHeader,sPostData) ALORS
    info(HErreurInfo(hErrComplet)+RC)
    	FinProgramme()
    	FIN
     
    	sResultHead = HTTPDonneRésultat(httpEntête)
    	sResultSource = HTTPDonneRésultat(httpRésultat)
    FIN
    Et finalement le debug de windev donne :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
     
    Mon compte utilisé est cecilebko et le mot de passe est lavieestbelle
     
    <-----Sent Headers----->
    USER AGENT = Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
    ADDITIONAL HEADER = 
    Cookie: __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=
    URL = https://accounts.spotify.com/en/login?continue=https://www.spotify.com/int/account/overview/
     
    <-----Received Headers----->
    HTTP/1.1 200 OK
    Server: nginx
    Date: Mon, 12 Feb 2018 01:09:19 GMT
    Content-Type: text/html;charset=utf-8
    Content-Length: 773
    Connection: keep-alive
    Keep-Alive: timeout=600
    Vary: Accept-Encoding
    Vary: Accept-Encoding
    Set-Cookie: csrf_token=AQCHapu4qDqI8f75-eo-4HeQ3x9nWXcVA7njdJl-ZfNaFUJ001OCsd7Zv0si6wdkNoWnYkTCHbZvwo5rd4Wk;Version=1;Domain=accounts.spotify.com;Path=/;Secure
    X-UA-Compatible: IE=edge
    X-Frame-Options: deny
    Content-Security-Policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://app.adjust.com https://itunes.apple.com itms-apps:;
    X-Content-Security-Policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://app.adjust.com https://itunes.apple.com itms-apps:;
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    X-Content-Type-Options: nosniff
    Strict-Transport-Security: max-age=31536000
     
     
    <------------------------------------------------------------------>
     
    <-----Received Source----->
     
    <!DOCTYPE html>
    <html ng-app="accounts" ng-csp>
      <head>
        <meta charset="utf-8">
        <title ng-bind="(title && (title | localize) + ' - ') + 'Spotify'">Spotify</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <base href="/">
        <link href="https://d2d1dxiu3v1f2i.cloudfront.net/a4a5157/css/index.css" media="screen" rel="stylesheet">
     
        <script async defer src="https://www.google.com/recaptcha/api.js"></script>
        <script async defer src="https://d2d1dxiu3v1f2i.cloudfront.net/a4a5157/js/index.js" sp-bootstrap></script>
        <meta ng-non-bindable sp-bootstrap-data='{"country":"ML","useCaptcha":false,"locales":["*"],"BON":["0","0",-305899249]}'>
      </head>
      <body ng-view></body>
    </html>
     
    <------------------------------------------------------------------>
     
    Connection via post - api
     
    <-----Sent Headers----->
     
    USER AGENT = Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
    ADDITIONAL HEADER = 
    Cookie: remember=cecilebko; csrf_token=AQCHapu4qDqI8f75-eo-4HeQ3x9nWXcVA7njdJl-ZfNaFUJ001OCsd7Zv0si6wdkNoWnYkTCHbZvwo5rd4Wk; Version=1; __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=
     
    URL = https://accounts.spotify.com/api/login
    POSTDATA = remember=true&username=cecilebko&password=lavieestbelle&csrf_token=AQCHapu4qDqI8f75-eo-4HeQ3x9nWXcVA7njdJl-ZfNaFUJ001OCsd7Zv0si6wdkNoWnYkTCHbZvwo5rd4Wk
     
    <------------------------------------------------------------------>
     
    Ici on n'a une mauvaise réponse !!! :(
     
    <-----Received Headers----->
     
    HTTP/1.1 400 Bad Request
    Server: nginx
    Date: Mon, 12 Feb 2018 01:09:20 GMT
    Content-Type: application/json
    Content-Length: 35
    Connection: keep-alive
    Keep-Alive: timeout=600
    Set-Cookie: csrf_token=AQD91YCzVrWcTonV7uIdns5dExoZXwBxgOlTlUGlyGhlZqpga79AYqTIbt7yJqiFAJ-Q1XaaoPORGqy-5WCN;Version=1;Domain=accounts.spotify.com;Path=/;Secure
     
     
    <------------------------------------------------------------------>
     
    <-----Received Source----->
     
    {"error":"errorInvalidCredentials"}
    <------------------------------------------------------------------>
    Espérant avoir assez bien expliqué mon problème...
    J'utilise pourtant httprequete depuis un bon moment et je n'ai jamais rencontré ce genre de problème.
    Maois là Je suis arrivé à mes limites. Et d'avance merci pour toute aide!

  2. #2
    Membre éprouvé
    Inscrit en
    avril 2008
    Messages
    1 088
    Détails du profil
    Informations forums :
    Inscription : avril 2008
    Messages : 1 088
    Points : 1 220
    Points
    1 220

    Par défaut A défaut de httprequete ...

    Bonsoir à tous,

    J'imagine que httprequete n'est pas très à la mode...

    Je me disais qu'à défaut de httprequete je pourrai bien utiliser la classe de JP avec cUrl.
    J'arrive à obtenir le résultat escompté même s'il est beaucoup plus lent que httprequete.
    Par contre j'ai un problème de multithreading avec cUrl.
    Mes questions sont donc :
    - Y a t-il un moyen d'envoyer des commandes cUrl depuis windev sans la console et/ou la classe ?
    - Dans ce cas est il possible d'utiliser cette commande cUrl dans plusieurs threads ?

    Merci d'avance.

    A titre d'info voici la trace de la connexion qui s'effectue correctement depuis windev à l'aide de cUrl :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    Mon compte
    cecilebko:lavieestbelle
     
    <------------------------------------------------------------------>
    Curl command : 
    H:\Mes Projets WD 20\SpotifyStatistics\Exe\curl\curl.exe --verbose --location --connect-timeout 100 --user-agent "Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00" --header "Cookie: __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=" https://accounts.spotify.com/en/login?continue=https:%2F%2Fwww.spotify.com%2Fint%2Faccount%2Foverview%2F/
    <------------------------------------------------------------------>
    GET METHODE
    USER AGENT = Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
    URL = https://accounts.spotify.com/en/login?continue=https:%2F%2Fwww.spotify.com%2Fint%2Faccount%2Foverview%2F/
     
     
    <------------------------------------------------------------------>
     
    RESULTA = 
     
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
     
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 104.199.64.136...
    * TCP_NODELAY set
    * Connected to accounts.spotify.com (104.199.64.136) port 443 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *   CAfile: H:\Mes Projets WD 20\SpotifyStatistics\Exe\curl\curl-ca-bundle.crt
      CApath: none
    } [5 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    } [218 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    { [109 bytes data]
    * NPN, negotiated HTTP2 (h2)
    { [5 bytes data]
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    { [2481 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    { [333 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    { [4 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    } [70 bytes data]
    * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
    } [1 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Unknown (67):
    } [36 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    } [16 bytes data]
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    { [16 bytes data]
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
    * ALPN, server did not agree to a protocol
    * Server certificate:
    *  subject: C=SE; L=Stockholm; O=Spotify AB; CN=*.spotify.com
    *  start date: May 16 00:00:00 2017 GMT
    *  expire date: Jul 29 12:00:00 2020 GMT
    *  subjectAltName: host "accounts.spotify.com" matched cert's "*.spotify.com"
    *  issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
    *  SSL certificate verify ok.
    * Using HTTP2, server supports multi-use
    * Connection state changed (HTTP/2 confirmed)
    * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
    } [5 bytes data]
    * Using Stream ID: 1 (easy handle 0x313a078)
    } [5 bytes data]
    > GET /en/login?continue=https:%2F%2Fwww.spotify.com%2Fint%2Faccount%2Foverview%2F/ HTTP/2
     
    > Host: accounts.spotify.com
     
    > User-Agent: Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
     
    > Accept: */*
     
    > Cookie: __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=
     
    > 
     
    { [5 bytes data]
    * Connection state changed (MAX_CONCURRENT_STREAMS updated)!
    } [5 bytes data]
     
      0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0< HTTP/2 200 
     
    < server: nginx
     
    < date: Mon, 12 Feb 2018 21:12:27 GMT
     
    < content-type: text/html;charset=utf-8
     
    < content-length: 773
     
    < vary: Accept-Encoding
     
    < vary: Accept-Encoding
     
    < set-cookie: csrf_token=AQBr1PFrsLs2VELmXM0nZOOMYaBZzA2zKvw8umw7FvxGVamvUAcFCbGQIKs4QQbDahadwxbPAaKxKFRR23k30HrmV6wMpRck3oeIYN3Brn5yEWkVevXi9fZzSt6kqcpX2p2MnuQ;Version=1;Domain=accounts.spotify.com;Path=/;Secure
     
    < x-ua-compatible: IE=edge
     
    < x-frame-options: deny
     
    < content-security-policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com https://www.google.com https://www.gstatic.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://profile-images.scdn.co https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://www.google.com https://app.adjust.com https://itunes.apple.com itms-apps:;
     
    < x-content-security-policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com https://www.google.com https://www.gstatic.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://profile-images.scdn.co https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://www.google.com https://app.adjust.com https://itunes.apple.com itms-apps:;
     
    < cache-control: no-cache, no-store, must-revalidate
     
    < pragma: no-cache
     
    < x-content-type-options: nosniff
     
    < strict-transport-security: max-age=31536000
     
    < 
     
    { [773 bytes data]
     
    100   773  100   773    0     0    773      0  0:00:01  0:00:01 --:--:--   773<!DOCTYPE html>
    <html ng-app="accounts" ng-csp>
      <head>
        <meta charset="utf-8">
        <title ng-bind="(title && (title | localize) + ' - ') + 'Spotify'">Spotify</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <base href="/">
        <link href="https://d2d1dxiu3v1f2i.cloudfront.net/d9ddd21/css/index.css" media="screen" rel="stylesheet">
     
        <script async defer src="https://www.google.com/recaptcha/api.js"></script>
        <script async defer src="https://d2d1dxiu3v1f2i.cloudfront.net/d9ddd21/js/index.js" sp-bootstrap></script>
        <meta ng-non-bindable sp-bootstrap-data='{"country":"ML","useCaptcha":false,"locales":["*"],"BON":["0","0",-236828013]}'>
      </head>
      <body ng-view></body>
    </html>
     
    * Connection #0 to host accounts.spotify.com left intact
     
    <------------------------------------------------------------------>
     
    <------------------------------------------------------------------>
    Curl command : 
    H:\Mes Projets WD 20\SpotifyStatistics\Exe\curl\curl.exe --verbose --location --connect-timeout 100 --user-agent "Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00" --header "Connection: keep-alive" --header "Content-Type: application/x-www-form-urlencoded" --cookie "csrf_token=AQBr1PFrsLs2VELmXM0nZOOMYaBZzA2zKvw8umw7FvxGVamvUAcFCbGQIKs4QQbDahadwxbPAaKxKFRR23k30HrmV6wMpRck3oeIYN3Brn5yEWkVevXi9fZzSt6kqcpX2p2MnuQ;  fb_continue=https%3A%2F%2Faccounts.spotify.com%2Fus%2Fstatus; remember=cecilebko; __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE="  -d "remember=true&username=cecilebko&password=lavieestbelle&csrf_token=AQBr1PFrsLs2VELmXM0nZOOMYaBZzA2zKvw8umw7FvxGVamvUAcFCbGQIKs4QQbDahadwxbPAaKxKFRR23k30HrmV6wMpRck3oeIYN3Brn5yEWkVevXi9fZzSt6kqcpX2p2MnuQ" https://accounts.spotify.com/api/login
    <------------------------------------------------------------------>
     
    POST METHODE
    USER AGENT = Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
    URL = https://accounts.spotify.com/api/login
    POSTDATA = remember=true&username=cecilebko&password=lavieestbelle&csrf_token=AQBr1PFrsLs2VELmXM0nZOOMYaBZzA2zKvw8umw7FvxGVamvUAcFCbGQIKs4QQbDahadwxbPAaKxKFRR23k30HrmV6wMpRck3oeIYN3Brn5yEWkVevXi9fZzSt6kqcpX2p2MnuQ
     
    <------------------------------------------------------------------>
     
    RESULTAT = 
     
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
     
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 104.199.64.136...
    * TCP_NODELAY set
    * Connected to accounts.spotify.com (104.199.64.136) port 443 (#0)
     
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* ALPN, offering h2
    * ALPN, offering http/1.1
    * successfully set certificate verify locations:
    *   CAfile: H:\Mes Projets WD 20\SpotifyStatistics\Exe\curl\curl-ca-bundle.crt
      CApath: none
    } [5 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    } [218 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    { [109 bytes data]
    * NPN, negotiated HTTP2 (h2)
    { [5 bytes data]
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    { [2481 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    { [333 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    { [4 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    } [70 bytes data]
    * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
    } [1 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Unknown (67):
    } [36 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    } [16 bytes data]
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    { [16 bytes data]
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
    * ALPN, server did not agree to a protocol
    * Server certificate:
    *  subject: C=SE; L=Stockholm; O=Spotify AB; CN=*.spotify.com
    *  start date: May 16 00:00:00 2017 GMT
    *  expire date: Jul 29 12:00:00 2020 GMT
    *  subjectAltName: host "accounts.spotify.com" matched cert's "*.spotify.com"
    *  issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
    *  SSL certificate verify ok.
    * Using HTTP2, server supports multi-use
    * Connection state changed (HTTP/2 confirmed)
    * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
    } [5 bytes data]
    * Using Stream ID: 1 (easy handle 0x53ca078)
    } [5 bytes data]
    > POST /api/login HTTP/2
     
    > Host: accounts.spotify.com
     
    > User-Agent: Opera/9.80 (Windows NT 6.0; U; en) Presto/2.2.0 Version/10.00
     
    > Accept: */*
     
    > Cookie: csrf_token=AQBr1PFrsLs2VELmXM0nZOOMYaBZzA2zKvw8umw7FvxGVamvUAcFCbGQIKs4QQbDahadwxbPAaKxKFRR23k30HrmV6wMpRck3oeIYN3Brn5yEWkVevXi9fZzSt6kqcpX2p2MnuQ;  fb_continue=https%3A%2F%2Faccounts.spotify.com%2Fus%2Fstatus; remember=cecilebko; __bon=MHwwfC00MjA5NzM5OTh8LTE3NjgwOTA3OTE2fDF8MXwxfDE=
     
    > Connection: keep-alive
     
    > Content-Type: application/x-www-form-urlencoded
     
    > Content-Length: 202
     
    > 
     
    { [5 bytes data]
    * Connection state changed (MAX_CONCURRENT_STREAMS updated)!
    } [5 bytes data]
    * We are completely uploaded and fine
    { [5 bytes data]
    < HTTP/2 200 
     
    < server: nginx
     
    < date: Mon, 12 Feb 2018 21:12:31 GMT
     
    < content-type: application/json
     
    < content-length: 27
     
    < vary: Accept-Encoding
     
    < set-cookie: sp_ac=AQBx7OmcariSq8Ua2W9XHEnXtn-QwDV59dduq23vLeNYHuW8HlDSiR0A0WC6ZolovqkkU02Uc-Lt4gG-QW5wCT7Xtw8pGJc2XxdDMY17C6bLWEAL21sTv3TWUhnRkMwLzwmXfDodciffFGP2trQS_EkL6Inb8Ig0H1G9TJ6ZIL6qfpJ_CpvOgzNpKb83lWCWG0nEcMnMBp4;Version=1;Domain=accounts.spotify.com;Path=/;Secure;HttpOnly
     
    < set-cookie: sp_dc=AQDjspbS8A7v6j2VyGLawhoPOgjrquQ4TyESnYp3hOk55bL50cfmvjkOIzH_VzaPVFxxMoPp-mJHF1b4NlJNdJIL;Version=1;Domain=spotify.com;Path=/;Max-Age=31536000;Secure;HttpOnly;Expires=Tue, 12 Feb 2019 21:12:31 GMT
     
    < set-cookie: csrf_token=AQDIgShhhCVFBcJxGTZiaw_i4ywHzavE6UkhFc_SrOSN9m-rwxDOdL5d98mr1XIvYDwf7HDNwMdwRRdX5_CliQ60Dqi2i2QicZ2XNy9gDOFL42SE72V3nGc4b7fo87U7R1ztaP0;Version=1;Domain=accounts.spotify.com;Path=/;Secure
     
    < x-ua-compatible: IE=edge
     
    < x-frame-options: deny
     
    < content-security-policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com https://www.google.com https://www.gstatic.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://profile-images.scdn.co https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://www.google.com https://app.adjust.com https://itunes.apple.com itms-apps:;
     
    < x-content-security-policy: default-src 'self'; script-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://www.google-analytics.com https://www.google.com https://www.gstatic.com; img-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://i.imgur.com https://d2mv8tnci56s9d.cloudfront.net https://profile-images.scdn.co https://aci.scdn.co https://graph.facebook.com https://fbcdn-profile-a.akamaihd.net https://scontent.xx.fbcdn.net https://www.google-analytics.com https://stats.g.doubleclick.net data: d2d1dxiu3v1f2i.cloudfront.net; font-src 'self' https://d2d1dxiu3v1f2i.cloudfront.net https://sp-bootstrap.global.ssl.fastly.net https://fonts.gstatic.com; style-src 'self' 'unsafe-inline' https://d2d1dxiu3v1f2i.cloudfront.net; frame-src 'self' https://www.spotify.com https://www.google.com https://app.adjust.com https://itunes.apple.com itms-apps:;
     
    < cache-control: no-cache, no-store, must-revalidate
     
    < pragma: no-cache
     
    < x-content-type-options: nosniff
     
    < strict-transport-security: max-age=31536000
     
    < 
     
    { [27 bytes data]
     
    100   229  100    27  100   202     36    274 --:--:-- --:--:-- --:--:--   311{"displayName":"cecilebko"}
    * Connection #0 to host accounts.spotify.com left intact
     
    <------------------------------------------------------------------>

  3. #3
    Membre expert
    Avatar de jurassic pork
    Homme Profil pro
    Bidouilleur
    Inscrit en
    décembre 2008
    Messages
    1 598
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Bidouilleur
    Secteur : Industrie

    Informations forums :
    Inscription : décembre 2008
    Messages : 1 598
    Points : 3 984
    Points
    3 984

    Par défaut

    hello,
    essaie de passer par la web api spotify voir ici
    Cela simplifiera certainement le code et les données retournées. Pour avoir accès à ce web service il faut s'enregistrer :
    To get an access token that a program can pass in calls to the Web API, the developer first needs to register the program at the Spotify Developer website. When the program has been registered, a Client ID and a Client Secret key will be generated and displayed on the application details page:
    Ami calmant, J.P
    Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

  4. #4
    Membre éprouvé
    Inscrit en
    avril 2008
    Messages
    1 088
    Détails du profil
    Informations forums :
    Inscription : avril 2008
    Messages : 1 088
    Points : 1 220
    Points
    1 220

    Par défaut

    Citation Envoyé par jurassic pork Voir le message
    hello,
    essaie de passer par la web api spotify
    Ami calmant, J.P
    Bonjour Maestro et merci pour l'aide. Je me suis donc enregistré et suis en train de lire la doc de l'api.
    Il m'a semblé qu'utiliser cette voie entraine l'utilisateur de mon appli a toujours s'identifier pour obtenir un token?

    Merci

Discussions similaires

  1. Impossible de supprimer 7 cookies
    Par VinnieMc dans le forum Sécurité
    Réponses: 22
    Dernier message: 25/09/2006, 22h39
  2. [JAVAMAIL] Impossible d'envoyer un mail
    Par alex75 dans le forum APIs
    Réponses: 6
    Dernier message: 22/05/2006, 17h32
  3. Impossible d'envoyer un formulaire avec javascript
    Par Mimi Bulles dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 14/11/2005, 20h37
  4. [Mail] Impossible d'envoyer un mail
    Par bugalood dans le forum Fonctions
    Réponses: 4
    Dernier message: 17/09/2005, 02h38
  5. Iptables - Ping & Connection 80 impossible vers sois même
    Par mickael.be dans le forum Sécurité
    Réponses: 3
    Dernier message: 03/06/2005, 01h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo