Giter Club home page Giter Club logo

Comments (7)

hyrijk avatar hyrijk commented on May 29, 2024 1

好像是有跨域的限制,抓包看了下 originfile://
WebRequest 里面加了这个可以匿名登录成功。

ajax.setRequestHeader('origin', 'localhost:8080')

我只试了匿名登录,然后调用云函数成功了,其他功能没试。

// init 之前先 use
tcb.useAdapters([RNAdapter])
const app = tcb.init({
  env: 'xxxx'
})

from tcb-js-sdk.

hyrijk avatar hyrijk commented on May 29, 2024

试了下把 sdk Web.ts 复制出来,简单修改下可以运行。runtime 继续填 web,不需要 appSecret

function genAdapter() {
  const reqClass: any = WebRequest
  const wsClass: any = WebSocket
  const adapter: SDKAdapterInterface = {
    reqClass,
    wsClass,
    root: global
    // localStorage: localStorage,
    // sessionStorage: sessionStorage
  }
  return adapter
}

const isMatch = () => true
const runtime = 'web'

export { genAdapter, isMatch, runtime }

from tcb-js-sdk.

puti94 avatar puti94 commented on May 29, 2024

是可以跑,但是验证通不过,功能都用不了

from tcb-js-sdk.

puti94 avatar puti94 commented on May 29, 2024

这样是可以解决匿名登录的问题了,但是我之前测试过自定义登录,接口报了个environment not match 的错误,兄弟有没有碰过,在react测试的

from tcb-js-sdk.

hyrijk avatar hyrijk commented on May 29, 2024

没有,自定义登录正准备开始写来着

from tcb-js-sdk.

hyrijk avatar hyrijk commented on May 29, 2024

自定义登录正常
auth.customAuthProvider().signIn(ticket)auth.linkAndRetrieveDataWithTicket(ticket)都是好的
https://gist.github.com/hyrijk/23dbb6d95b21f26341581b10c1181e0e

from tcb-js-sdk.

puti94 avatar puti94 commented on May 29, 2024

const tcb = require('tcb-admin-node') const credentials = require('./pem.json'); const app = tcb.init({ env: tcb.getCurrentEnv(), credentials }); exports.main = async function (event) {
晕了,之前环境问题是因为我初始化放在云函数外面了,tcb.getCurrentEnv() 这个方法获取环境获取不到

from tcb-js-sdk.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.