Sign-in with Google (deprecated)
How to sign-in users using their Google Account.
Setting-up a Google Account integration
Sign in to your Prepr account
Go to https://signin.prepr.io and sign in with your Prepr account credentials.
Then navigate to the Environment you want to create the Sign-In for.
Set-up integration
Go to Settings
-> Integrations
and click Activate
below the Google App integration.
Enter a name, your App Id, Secret key and click save.
Copy the Sign-in Url
you need this later.
Redirect the customer to the Google Sign-In page
After a customer has clicked on the "Sign-In" link on your front-end, the customer is redirected to the Google Sign-In page. After a sign-in the Prepr API will redirect the customer back to your front-end.
Example url:
https://customers.prepr.io/sign_in/google/kh3478234hjkh28346832y4hj@google-consent.com?redirect_url=https://example.com/google_login_handler
Implementing a Sign-In handler
If the customer clicks on the sign-in link, the API will redirect the customer back to your site.
The API will add a query param access_token
to the url.
https://example.com/google_login_handler?access_token=<YOUR-ACCESS-TOKEN>
This token is a temporary sign-in token
. To use this for following requests we need to
convert it to an Personal Access Token
.
This is pretty simple, just create a POST request to https://customers.prepr.io/customers/sign_in_with_magic?ttl=0
with the received token as the Authentication Bearer header.
This will result in a new Personal Access Token for the customer:
{
"id": "ef1088eb-2f29-4acc-8748-73bebd99c703",
"last_seen": "2021-03-01T15:35:58+00:00",
"first_name": "Ryan",
"last_name": "Vaughan",
"access_token": {
"access_token": "HBM0kZq60ers7U11k3Gm7QlN6gCHjj1rAH0T74J9vnY2Gyv7xIFE3yE0gfuyHp",
"token_type": "Bearer",
"expires_in": null
}
}
Done! 🥳 You've completed the sign-in. The new token can now be used to create events or personalized API requests.