Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hastearcade/haste-sdk into main
Browse files Browse the repository at this point in the history
  • Loading branch information
foundrium committed Feb 21, 2022
2 parents 6e99252 + d485843 commit 812e293
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
16 changes: 6 additions & 10 deletions examples/authentication/single-page-app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@ function App() {
// The token should be passed to the game server
// with every game state change and be validated
// by your game server.
const getToken = async () => {
if (hasteClient) {
const details = await hasteClient.getTokenDetails();
setPicture(details.picture);
setDisplayName(details.displayName);
setAuthenticated(details.isAuthenticated);
}
};

getToken();
if (hasteClient) {
const details = hasteClient.getTokenDetails();
setPicture(details.picture);
setDisplayName(details.displayName);
setAuthenticated(details.isAuthenticated);
}
}, [hasteClient]);

return hasteClient ? (
Expand Down
6 changes: 3 additions & 3 deletions examples/authentication/umd-app/auth/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@
</div>
<script src="https://unpkg.com/@hastearcade/web/dist/umd/index.js"></script>
<script>
async function initialize() {
function initialize() {
// initialize the haste client
// perform get token details
// if the user is not authenticated
// then show the unauthenticated version of the page
// otherwise show the authenticated version with the
// player's profile details
try {
hasteClient = await haste.HasteClient.build();
hasteClient = haste.HasteClient.build();
console.log(hasteClient);
const details = await hasteClient.getTokenDetails();
const details = hasteClient.getTokenDetails();
console.log(details);

if (details.isAuthenticated) {
Expand Down

0 comments on commit 812e293

Please sign in to comment.