Thanks, TonyM. I was thinking this would be an easy way to record who
edited what. The Google login button is easy to create in HTML. But the
challenges here are,
- How to add content to the <head> area in TW
- How to add content to the <script> area in TW
Here is an example of HTML
<html lang="en">
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="the client ID generated
by Google">
<script src="https://apis.google.com/js/platform.js" async
defer></script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"
data-theme="dark"></div>
<script>
function onSignIn(googleUser) {
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly
to your server!
console.log('Full Name: ' + profile.getName());
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());
// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
}
</script>
</body>
</html>
Cheers,
Chun
On Thursday, January 17, 2019 at 7:44:19 PM UTC+13, TonyM wrote:
>
> Chun,
>
> I would love for this to work, but do not know where to start myself.
> Please share if you have any luck.
>
> Regrds
> Tony
>
> On Wednesday, January 16, 2019 at 10:14:58 PM UTC+11, CHUN LI wrote:
>>
>> Hello,
>>
>> I am trying to ask my TiddlyWiki visitors (hosting on node.js) to
>> login to their Google account then use their Google username to populate a
>> field in tiddlers.
>>
>> Google's official guide is easy to follow
>> https://developers.google.com/identity/sign-in/web/sign-in
>>
>> But I cannot work out how to do this in TiddlyWiki (if this is possible).
>>
>> So the logic is:
>>
>> 1. Add a Google sign in button to a tiddler.
>> 2. Visitors click on the button to sign in to their Google account.
>> 3. Using a macro to capture visitor's Google username.
>> 4. The macro will also add the username to the tiddlers this user
>> created or edited.
>> 5. There will be a versioning system to show tiddllers have been
>> edited by multiple users or multiple times.
>>
>> Thanks!
>>
>> Chun
>>
>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/88685956-d90b-4c32-aded-9b12aa953e99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.