Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何将react本机应用程序与spring boot oauth2集成_Reactjs_Spring Boot_React Native_Oauth 2.0 - Fatal编程技术网

Reactjs 如何将react本机应用程序与spring boot oauth2集成

Reactjs 如何将react本机应用程序与spring boot oauth2集成,reactjs,spring-boot,react-native,oauth-2.0,Reactjs,Spring Boot,React Native,Oauth 2.0,我有一个具有oauth2配置的spring引导应用程序,如下所示: spring: security: oauth2: client: registration: google: clientId: clientIdValue clientSecret: clientSecretValue redirectUri: "https://localhost/oauth2

我有一个具有oauth2配置的spring引导应用程序,如下所示:

spring:
  security:
    oauth2:
      client:
        registration:
          google:
            clientId: clientIdValue
            clientSecret: clientSecretValue
            redirectUri: "https://localhost/oauth2/callback/{registrationId}"
            scope:
              - email
              - profile
          facebook:
            clientId: clientIdValue
            clientSecret: clientSecretValue
            redirectUri: "https://localhost/oauth2/callback/{registrationId}"
            scope:
              - email
              - public_profile
        provider:
          facebook:
            authorizationUri: https://www.facebook.com/v3.0/dialog/oauth
            tokenUri: https://graph.facebook.com/v3.0/oauth/access_token
            userInfoUri: https://graph.facebook.com/v3.0/me?fields=id,first_name,middle_name,last_name,name,email,verified,is_verified,picture.width(250).height(250)
现在,我有了一个react本地应用程序,它使用插件登录google。如何将此react本机应用程序与登录/注册中的spring boot应用程序集成


正如您在插件中所看到的,它在选项中没有任何回调或重定向url。

我在不使用任何插件的情况下解决了这个问题,就在用户触摸google或facebook登录时,我将用户重定向到google或facebook,例如到
https://localhost/oauth2/authorize/google?redirect_uri=https://localhost/oauth2/redirect


授权完成后,我检查用户是否来自移动设备(使用用户代理信息),如果是真的,我将用户重定向到
myapp://accessToken/{{token\u value\u from\u google\u或\u facebook}
,通过此重定向,我的移动应用程序打开,一切正常。

是的,我回答了我的问题。