Workflow Social Auth and Spa?


#1

Hi, i have a question about SPA and Social Auth

So when

user press as example “Login with Facebook” i redirect the user to the facebook redirect url and then it hits the Server? but i have no idea how to tell my SPA to get the JWT

async providerCallback ({
    params,
    ally,
    auth,
    response
  }) {
    try {
      const socialUser = await ally.driver(params.provider).getUser()
      const userDetails = {
        email: socialUser.getEmail(),
        token: socialUser.getAccessToken(),
        provider: params.provider
      }

      const whereClause = {
        email: socialUser.getEmail()
      }

      const user = await User.findOrCreate(whereClause, userDetails)
      const token = await auth.generate(user)

      return token
    } catch (error) {
      console.log(error)
    }
  }

maybe i need a way to get just the access_token from facebook direct and validate it on the server Save the user and create the jwt token

i just cant get my head around this

thanks