lib/authing_ruby/authentication/AuthenticationClient.rb in authing_ruby-1.0.6 vs lib/authing_ruby/authentication/AuthenticationClient.rb in authing_ruby-1.0.7

- old
+ new

@@ -37,10 +37,15 @@ # 以下几个参数主要用于 "标准协议认证模块" @tokenEndPointAuthMethod = options.fetch(:tokenEndPointAuthMethod, 'client_secret_post') @introspectionEndPointAuthMethod = options.fetch(:introspectionEndPointAuthMethod, 'client_secret_post') @revocationEndPointAuthMethod = options.fetch(:revocationEndPointAuthMethod, 'client_secret_post') + + token = options.fetch(:token, nil) + if token + setToken(token) + end end # 使用邮箱+密码注册 (完成, 测试通过) # 参照: https://docs.authing.cn/v2/reference/sdk-for-node/authentication/AuthenticationClient.html # 测试代码: @@ -270,10 +275,10 @@ # 获取当前登录的用户信息 # 返回:用户信息 def getCurrentUser() graphqlAPI = AuthingRuby::GraphQLAPI.new - res = graphqlAPI.getCurrentUser(@graphqlClient, @tokenProvider, variables) + res = graphqlAPI.getCurrentUser(@graphqlClient, @tokenProvider, {}) json = JSON.parse(res) user = json.dig("data", "user") if user setCurrentUser(user) return user \ No newline at end of file