我有一个使用Parse API的XCode项目,但我现在正在尝试将可可触摸包装器集成到spotify中.我得到一个非常令人沮丧的链接器错误,我已经在两个小时工作,但没有用.任何帮助将非常感激!这是错误.谢谢!
Undefined symbols for architecture x86_64:
"_FBTokenInformationExpirationDateKey", referenced from:
-[PFFacebookTokenCachingStrategy cacheTokenInformation:] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy expirationDate] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setExpirationDate:] in Parse(PFFacebookTokenCachingStrategy.o)
"_FBTokenInformationTokenKey", referenced from:
-[PFFacebookTokenCachingStrategy accessToken] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setAccessToken:] in Parse(PFFacebookTokenCachingStrategy.o)
"_FBTokenInformationUserFBIDKey", referenced from:
-[PFFacebookTokenCachingStrategy facebookId] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setFacebookId:] in Parse(PFFacebookTokenCachingStrategy.o)
"_OBJC_CLASS_$_FBAppCall", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"_OBJC_CLASS_$_FBRequest", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"_OBJC_CLASS_$_FBSession", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"_OBJC_CLASS_$_FBSessionTokenCachingStrategy", referenced from:
_OBJC_CLASS_$_PFFacebookTokenCachingStrategy in Parse(PFFacebookTokenCachingStrategy.o)
"_OBJC_METACLASS_$_FBSessionTokenCachingStrategy", referenced from:
_OBJC_METACLASS_$_PFFacebookTokenCachingStrategy in Parse(PFFacebookTokenCachingStrategy.o)
ld: symbol(s) not found for architecture …
Run Code Online (Sandbox Code Playgroud) 使用这些信息
https://developer.spotify.com/web-api/authorization-guide
我正在尝试实施“客户端凭据流程”以自动进行身份验证过程。但是我莫名其妙地收到下面的错误。
XMLHttpRequest无法加载https://accounts.spotify.com/api/token?grant_type=client_credentials。所请求的资源上没有“ Access-Control-Allow-Origin”标头。因此,不允许访问源“ websiteURL”。
$http.get('https://accounts.spotify.com/api/token?grant_type=client_credentials', {
headers: {
'Authorization': 'Basic ' + key)
}
}).success(function(r) {
console.log('got access token', r);
}).error(function(err) {
console.log('failed to get access token', err);
});
Run Code Online (Sandbox Code Playgroud)
我也通过Ajax / Jquery和其他方法进行了尝试,但是仍然有一个“ Access-Control-Allow-Origin”。
我已经阅读了很多有关CORS,Angular,Node等的内容。老实说,我很困惑应该使用其中的哪些,但我不知道如何使用。有人可以为我简化一下吗?
因此,我正在尝试使用 Spotify Web API 构建授权流程。因此,第一个调用只是针对 URL 的 GET,我正在传递授权我的应用程序所需的凭据和其他内容作为参数。之后,系统会提示用户授权我的应用程序,然后将其重定向到回调 URL。
我重定向到的 url 包含一些响应数据作为参数,我需要这些数据然后针对 API POST 并检索令牌。
如何检索响应 URL 并访问这些参数?很抱歉这个幼稚的问题。提前致谢。
使用Python,我试图通过在段落客户端凭证按照说明做一个POST调用API的Spotify流在链路https://developer.spotify.com/web-api/authorization-guide/#client_credentials_flow和这是我提出的代码.但是,当我运行它时,我得到了响应[415].谁能告诉我有什么问题?
import pprint
import requests
import urllib2
import json
import base64
client_id='b040c4e03217489aa647c055265d0ac'
client_secret='2c2928bb7d3e43278424002d2e8bda46b'
authorization_param='Basic ' + base64.standard_b64encode(client_id + ':' + client_secret)
grant_type='client_credentials'
#Request based on Client Credentials Flow from https://developer.spotify.com/web-api/authorization-guide/
#Header must be a base 64 encoded string that contains the client ID and client secret key.
#The field must have the format: Authorization: Basic <base64 encoded client_id:client_secret>
header_params={'Authorization' : authorization_param}
#Request body parameter: grant_type Value: Required. Set it to client_credentials
body_params = {'grant_type' : grant_type}
url='https://accounts.spotify.com/api/token'
response=requests.post(url, …
Run Code Online (Sandbox Code Playgroud) 我正在需要访问用户的 Spotify 帐户的 Django 应用程序中实现 Python Social Auth。身份验证流程中的初始步骤有效:将请求发送到 Spotify 的“/授权”端点,并向用户显示一个模式,解释应用程序将被授权的访问范围。但是,当应用程序的重定向 uri 被请求时 ('/completed/spotify/') 会引发此异常:
AuthMissingParameter at /complete/spotify/
Missing needed parameter state
Request Method: GET
Request URL: http://127.0.0.1:8000/complete/spotify/
Django Version: 1.8.2
Exception Type: AuthMissingParameter
Exception Value:
Missing needed parameter state
Exception Location: /Users/brandon/Envs/group_playlist_generator/lib/python2.7/site-packages/social/backends/oauth.py in validate_state, line 86
Python Executable: /Users/brandon/Envs/group_playlist_generator/bin/python
Python Version: 2.7.9
Python Path:
['/Users/brandon/dev/group_playlist_generator',
'/Users/brandon/Envs/group_playlist_generator/lib/python27.zip',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/plat-darwin',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/plat-mac',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/lib-tk',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/lib-old',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/lib-dynload',
'/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/brandon/Envs/group_playlist_generator/lib/python2.7/site-packages']
Run Code Online (Sandbox Code Playgroud)
这个问题可能只是我在 Auth 方面的经验的一个函数,尤其是在 Django 的上下文中。我已经阅读了 PSA 源代码的相关部分,但我不明白这个“状态”参数是如何在 Spotify 和应用程序之间传递的。我看到此参数已添加到对 Spotify 的原始请求中,但我不确定如何确保将其传递回重定向 …
我使用passport-spotify - https://github.com/jmperez/passport-spotify在我的网络应用程序中进行身份验证,我无法将用户重定向回上一页.
我查看了https://github.com/jaredhanson/connect-ensure-login,其中讨论了将req.url存储在req.session.return中供以后使用.但是当我从spotify收到"/ callback"时,这不是b/c工作,req.session.returnTo未定义.
非常感谢任何帮助.
这似乎是一个简单的问题,我必须忽略一些小事.
我有一个访问Spotify API并搜索艺术家的功能.我知道通过普通URL访问此路由会返回结果.(例如http://localhost:3001/search?artist=%27Linkin%20Park%27
)这里的代码:
router.get('/search', function(req, res, next)
{
var artist = req.param('artist');
console.log("Artist: " + artist);
smartSpot.getArtistID(artist, function(data)
{
console.log("Data: " + data);
res.json(data.id);
});
});
Run Code Online (Sandbox Code Playgroud)
然后,前端有代码搜索艺术家.这都是通过角度完成的.
angular.module('smart-spot', [])
.controller('MainCtrl', [
'$scope', '$http',
function($scope, $http)
{
$scope.createPlaylist = function()
{
var artist = $scope.artist;
console.log(artist);
window.open("/login", "Playlist Creation", 'WIDTH=400, HEIGHT=500');
return $http.get('/search?=' + $scope.artist) //this doesn't pass in the artist
.success(function(data)
{
console.log(data);
});
}
}
]);
Run Code Online (Sandbox Code Playgroud)
该$http.get()
不会在$ scope.artist`值传递正确.
尝试在 current_track() 函数中检查无 200 响应。有什么问题?它抛出 JSONDecodeError 错误。但是,如果我正确理解 raise_for_ status ,它应该阻止该函数尝试从错误的网页加载 JSON 吗?如果我在没有此检查的情况下运行脚本并且使用取消注释行 check_playback() 它将成功捕获 JSONDecodeError。
该脚本正在从 Spotify 获取数据并将其置于 vk.com 上的状态。
import config
import webbrowser
import requests
import furl
import secrets
import string
import time
import os
import simplejson as json
URL_CODE_BASE_VK = 'https://oauth.vk.com/authorize'
URL_CODE_BASE_SP = 'https://accounts.spotify.com/authorize'
URL_TOKEN_VK = 'https://oauth.vk.com/access_token'
URL_TOKEN_SP = 'https://accounts.spotify.com/api/token'
URL_TRACK = 'https://api.spotify.com/v1/me/player/currently-playing'
URL_STATUS = 'https://api.vk.com/method/status.set'
EXP_IN_TOKEN_SP = 3400
EXP_IN_TOKEN_VK = 86400
FILE_TOKEN_VK = 'vk_token.json'
FILE_TOKEN_SP = 'sp_token.json'
def get_auth_code_vk():
url_code_params = {
'client_id': config.CLIENT_ID_VK,
'response_type': 'code',
'redirect_uri': …
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个脚本,在 python 中的我的 Spotify 帐户上创建播放列表,从头开始,而不是使用像spotipy这样的模块。
我的问题是如何使用请求模块对我的客户端 ID 和客户端密钥进行身份验证,或者如何使用这些凭据获取访问令牌?
我正在尝试接收refresh_token
我的 Ionic 应用程序,我成功接收了access_token
.
我从我的 TypeScript 项目中的端点接收code
(authorization_code
或access_token
)https://accounts.spotify.com/authorize?client_id=
,我将它传递cURL
给测试如何获取refresh_token
但唯一收到错误的东西。
curl -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic MzBhNT...ZWIyZWQ=" -d grant_type=authorization_code -d code=BQAjgZOFne3p8PB4ARJkrXtq...kI4xJvhQ7SutZoJqVWILCY -d redirect_uri=http%3A%2F%2Flocalhost%3A8100%2Fmain -X POST https://accounts.spotify.com/api/token
Run Code Online (Sandbox Code Playgroud)
预期输出:
{
"access_token": "NgCXRK...MzYjw",
"token_type": "Bearer",
"scope": ...,
"expires_in": 3600,
"refresh_token": "NgAagA...Um_SHo"
}
Run Code Online (Sandbox Code Playgroud)
但收到错误:
{"error":"invalid_grant","error_description":"Invalid authorization code"}
Run Code Online (Sandbox Code Playgroud) spotify ×10
python ×5
express ×2
javascript ×2
node.js ×2
angularjs ×1
api ×1
api-design ×1
django ×1
http ×1
http-post ×1
insomnia ×1
ios ×1
oauth-2.0 ×1
objective-c ×1
passport.js ×1
post ×1
python-3.x ×1
spotify-app ×1
xcode ×1