我在iOS应用程序中使用strava登录.对strava进行身份验证后,我无法返回到我的应用程序 [英] I am using strava login in my ios application.After authentication of strava I am not able to get back to my application
问题描述
我已经使用了这个库.
注意:我遇到的一个难题是,作用域实际上是一个逗号分隔的数组.我使用示例应用程序不断列出它的所有活动,但总是出错,但这是因为我没有包含"ReadAll"字样.进入范围(我的目标是将TCX文件上传到Strava).
I have used this library. https://github.com/mpclarkson/StravaSwift
My callback url redirects me to any browser link but does not redirect me to my app.How can I redirect back to my app after authentication from strava?
OP Mentioned usage of this GitHub cocoa pods -> https://github.com/mpclarkson/StravaSwift
using the example app within the GitHub project, the following is what is needed for redirect back to the app after Strava oAuth authentication.
info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.stravaswift.ios</string>
<key>CFBundleURLSchemes</key>
<array>
<string>breakaway</string> <--- This is my App Name
</array>
</dict>
</array>
Note that per the readme.md file for that project page you also need this
<key>LSApplicationQueriesSchemes</key>
<array>
<string>strava</string>
</array>
Then within appDelegate.swift (also per the readme.md)
let config = StravaConfig(
clientId: <YOUR_CLIENT_ID>,
clientSecret: <YOUR_CLIENT_SECRET>,
redirectUri: "breakaway://breakaway701849232.wordpress.com",
scopes: [.activityReadAll,.activityWrite]
)
Note that the redirectUri is "breakaway" :// "breakaway701849232.wordpress.com" where : breakaway - my redirectUri breakaway701849232.wordpress.com - my domain (That is inputed into Strava API for my app)
NOTE: One Gotcha I fell into was that the Scopes is actually a comma delimited array. I kept getting errors using the example app where it lists all the activities but it was because I did not include a "ReadAll" into the scope (My goal is to upload TCX files to Strava).
这篇关于我在iOS应用程序中使用strava登录.对strava进行身份验证后,我无法返回到我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!