How get clientID and secret key
curl -X PUT -H "Content-Type: application/json" \ https://api.directual.com/good/v4/auth \
-d '{
"appID":"de87a6f7-a1e5-4b31-9d13-37c842b259a",
"provider": "google"
"code": "37c842b259a...",
"clientID": "de87a6f7....",
"redirect_uri": "http://mywebsite.app/login"
}'
Example auth for React js
npm install react-google-login --save
import { GoogleLogin } from 'react-google-login';
<GoogleLogin
clientId={you_client_id}
buttonText="Login"
accessType={"offline"}
responseType={"code"}
onSuccess={(d)=>{
let url = `http://api.directual.com/good/api/v4/auth/`
let body = { provider: "google", token: d.code, clientID: you_client_id }
fetch(url, {
method: 'POST',
body: JSON.stringify(req.body),
headers: {
'Content-Type': 'application/json'
}
}).then(res2=>{
res2.json().then(result=>{
res.end(JSON.stringify(result))
}).catch((data)=>{
res.end('error')
})
})
}}
onFailure={(d)=>{
}}
cookiePolicy={'single_host_origin'}
/>