I think you can do this. On the last step (#7 from your documentation link), when you get redirected back to /connect//redirect, the front-end code gets the JWT, and can optionally save other data (in this case, to localStorage). An example of the front-end handling this is here:
import React, { useEffect, useState } from 'react';
import { useHistory, useLocation, useParams } from "react-router-dom";
const backendUrl = process.env.REACT_APP_BACKEND_URL;
const LoginRedirect = (props) => {
const [text, setText] = useState('Loading...');
const location = useLocation();
const params = useParams();
const history = useHistory();
useEffect(() => {
// Successfully logged with the provider
// Now logging with strapi by using the access_token (given by the provider) in props.location.search
fetch(`${backendUrl}/api/auth/${params.providerName}/callback${location.search}`)
.then(res => {
if (res.status !== 200) {
throw new Error(`Couldn't login to Strapi. Status: ${res.status}`);
}
return res;
This file has been truncated. show original
Notice that it saves a couple items:
localStorage.setItem('jwt', res.jwt);
localStorage.setItem('username', res.user.username);
I think there’s more in the res.user object that you can introspect