小编yos*_*nbo的帖子

如何从 auth-module、Nuxt.js 获取 access_token

我尝试使用以下链接使用 Nuxt.js 使用 auth-module 构建 Facebook 登录。

https://github.com/nuxt-community/auth-module

我无法获得“access_token”。代码如下。

// pages/login.vue
export default {
   methods: {
       this.$auth.loginWith('facebook')
   }
}
Run Code Online (Sandbox Code Playgroud)

回调URI是这样的。

https://localhost:3000/facebook/oauth_callback/?#access_token=***&data_access_expiration_time=1561715202&expires_in=4398&reauthorize_required_in=7776000&state=MC4xOTU3MDM2ODIxMzIzOTA5OA
Run Code Online (Sandbox Code Playgroud)
// pages/facebook/oauth_callback/index.vue
<template>
  <section>
    <p>{{ this.$auth.$state }}</p>
    <p>{{ this.$route.query }}</p
  </section>
</template>
Run Code Online (Sandbox Code Playgroud)

this.$auth.$state 不包括“access_token”。我怎样才能获得“access_token”?我也不明白为什么 URI 在获取参数字段中包含“#”。因此,我无法从“this.$route.query”获取 access_token。

javascript facebook nuxt.js

21
推荐指数
2
解决办法
7819
查看次数

如何在Swift代码中将元组追加到数组对象?

我搜索谷歌,但我找不到一种方法将新元素追加到Swift中的数组对象.出现错误代码"Missing arguments fot parameter"name in in call".我的代码被遵循.

var arrayObj: [(id: Int, name: String)] = []
var idInt: Int = 1
var nameString: String = "hoge"
arrayObj.append((        // ----> "Missing arguments fot parameter "name" in call"
    id: idInt,
    name: nameString
))
Run Code Online (Sandbox Code Playgroud)

如果你知道任何解决方案,我会很高兴.谢谢.

swift xcode6

9
推荐指数
3
解决办法
6483
查看次数

标签 统计

facebook ×1

javascript ×1

nuxt.js ×1

swift ×1

xcode6 ×1