Here is a simple register and login -
local widget = require "widget" CC\_Access\_Key = "xxxxxx" CC\_Secret\_Key = "xxxxxx" coronaCloud = require ( "corona-cloud-core" ) coronaCloud.init( CC\_Access\_Key, CC\_Secret\_Key ) -- This is for using the Cloud Dashboard gameNetwork = require( "gameNetwork" ) local params = { accessKey = CC\_Access\_Key, secretKey = CC\_Secret\_Key, } gameNetwork.init( "corona", params ) local currentAuthToken = "" --variable to store the login 'authToken' local function loginSuccess( event ) --store the 'authToken' on login success currentAuthToken = coronaCloud.authToken print("logged in") end local function loginFailure( event ) --clear the 'authToken' on login failure currentAuthToken = "" print("login failure") print(event.type) end local function registrationHandler( event ) --code to handle the registration --this is a logical place to call the login code print("registered") end Runtime:addEventListener( "LoggedIn", loginSuccess ) Runtime:addEventListener( "LoginError", loginFailure ) Runtime:addEventListener( "UserRegistered", registrationHandler ) local function btnLogin\_Click( event ) coronaCloud.loginAPI( "email", "password" ) end local function btnRegister\_Click( event ) coronaCloud.registerUser( "firstname", "surname", "username", "email", "password" ) end local btnLogin = widget.newButton{ label = "Login", labelColor = { default={ 255, 255, 255, 255 }, over={ 0 } }, defaultColor = { 64, 153, 255, 255 }, overColor = { 64, 153, 255, 200 }, strokeColor = { 255, 255, 255, 255 }, width = 180, height = 44, fontSize = 24, onRelease = btnLogin\_Click } btnLogin.x = display.contentCenterX btnLogin.y = display.contentCenterY - 50 local btnRegister = widget.newButton{ label = "Register", labelColor = { default={ 255, 255, 255, 255 }, over={ 0 } }, defaultColor = { 64, 153, 255, 255 }, overColor = { 64, 153, 255, 200 }, strokeColor = { 255, 255, 255, 255 }, width = 180, height = 44, fontSize = 24, onRelease = btnRegister\_Click } btnRegister.x = display.contentCenterX btnRegister.y = display.contentCenterY + 50
In corona-cloud-core.lua set -
coronaCloudController.debugEnabled = true
To see lots of information.
Dave