react-native - Expo React Native:Strava 身份验证进入网站
问题描述
希望有人已经对此进行了研究,并可以帮助我合并 Strava oauth。应该发生的情况是用户单击了使用 strava 连接按钮,并且在授权应用程序后应该重定向到 myApp。但是,strava 说 redirectURL 对于前 2 个选项无效(因为它是一个包含 expo URL 的字符串,即使它是一个独立的托管工作流应用程序)。myApp 的第三个选项是有效的,但不会将用户重定向回应用程序或任何东西。第四个选项有效,但是用户被重定向到网站,这当然不是目标。
const openStravaAuth = async () => {
// These do not work
// const redirect = await Linking.getInitialURL() + '/stravaAuth'
// const redirect = Linking.makeUrl('/stravaAuth')
// const redirect = 'myApp://myApp.com'
// This does work, but redirects user to browser and that will create a whole new user if they are not logged in there
const redirect = 'https://myApp.com/stravaAuth' // This one works
const url = `https://www.strava.com/oauth/authorize?client_id=${STRAVA_CLIENT_ID}&response_type=code&redirect_uri=${redirect}&approval_prompt=force`
const result = await WebBrowser.openAuthSessionAsync(url, redirect)
}
解决方案
推荐阅读
- javascript - 在窗口中的所有选项卡上运行 Applescript
- ruby-on-rails - 在 rake 任务中比较两个表的日期字段
- .net-core - 推送到开发服务器和产品服务器时,如何在 appsettings.json 和 appsettings.Development.json 之间进行选择?
- wso2 - 在 WSO2 API Manager Publisher 中创建了重复的 API
- php - 两个图像不会在 PHP 中同时创建缩略图
- azure - Azure API 管理接受事件网格 Web 挂钩(验证提供的终结点时出错)
- apache-spark - eval() 在 Pyspark 的 UDF 中不起作用
- ruby-on-rails - 无法更新外键
- linkedin - “无效的内容实体类型!” 发布到 Linkedin v2/shares 时
- asp.net - 如何在asp.net mvc的视图中检查从控制器接收到的值不为空?