我在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

查看:214
本文介绍了我在iOS应用程序中使用strava登录.对strava进行身份验证后,我无法返回到我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了这个库.

注意:我遇到的一个难题是,作用域实际上是一个逗号分隔的数组.我使用示例应用程序不断列出它的所有活动,但总是出错,但这是因为我没有包含"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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆