Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Unable to Sign In successfully using plugin.googleSignIn by Scott
Started by harrison.minibucks Jan 04 2020 09:05 PM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

harrison.minibucks

[GLOBAL: userInfoPane.html]
harrison.minibucks
  • Observer

  • 6 posts
  • Corona SDK

I have been following the documentations here (https://scotth.tech/plugin-googleSignIn), I have been trying to set up Google Sign In for an Android App only. But it keeps showing the error and I have no way to retrieve more information about what's wrong because I'm not sure how you debug on Android. (Since the plugin is not supported on Windows)

 

Am I missing any obvious steps? Meanwhile, I'll probably should start learning how to debug from https://docs.coronalabs.com/guide/basics/debugging/index.html

 

Below are my files for build.settings and main.lua (I've only replaced the androidClientID). Attached screenshot is the outcome after I pick an account from the "Choose an account".

*I have my google-services.json in the same folder with main.lua

 

build.settings

settings = 
{
  orientation = 
  {
    -- Supported values for orientation:
    -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
    default = "portrait",
    supported = { "portrait", },
  },

  --
  -- Android section
  --
  android = 
  {
    useGoogleServicesJson = true,
    usesPermissions = 
    {
      "android.permission.INTERNET",
    },
  },

  --
  -- iOS section
  --
  iphone = 
  {
    xcassets = "Images.xcassets",
    plist = 
    {
      UIStatusBarHidden = false,
      UILaunchStoryboardName = "LaunchScreen",
    },
  },

  --
  -- Plugins section
  --
  plugins = 
  {
    ["plugin.googleSignIn"] = 
    {
      publisherId = "tech.scotth",
    }
  },

  --
  -- Project section
  --
  excludeFiles = 
  {
    -- Exclude unnecessary files for each platform
    all = { "Icon.png", "Icon-*dpi.png", "Images.xcassets", },
    android = { "LaunchScreen.storyboardc", },
  },
}

main.lua (Copied from https://github.com/scottrules44/googleSignIn-demo/blob/master/main.lua)

local googleSignIn = require "plugin.googleSignIn"
local json = require("json")
googleSignIn.init()
local widget = require("widget")
local androidClientID = "xxxMyID"
local clientID = "replace with client id (iOS)" -- iOS deafult
if (system.getInfo("platform") == "android") then
    clientID = androidClientID
end
local bg = display.newRect( display.contentCenterX, display.contentCenterY, display.actualContentWidth, display.actualContentHeight )
bg:setFillColor( 0,0,1 )

local title = display.newText( "Google Sign In", display.contentCenterX, 40, native.systemFontBold ,30)

local signIn = widget.newButton( {
	label = "Sign In",
	fontSize = 20,
	labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } },
	x = display.contentCenterX,
	y = display.contentCenterY,
	onRelease = function ( e )
        googleSignIn.signIn(clientID, nil,nil,function ( ev )
            if (ev.isError == true) then
                native.showAlert("Error Sign In", ev.error, {"Ok"})
            else
                native.showAlert("Signed In", json.encode(ev), {"Ok"})
            end
			print( json.encode( ev ) )
		end)
	end,
} )

7aDrVtZ.png



[TOPIC: post.html]
#2

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,842 posts
  • Enterprise

Do you mind pm'ing or emailing me your project? If I can get your id I may be able to help see the step you missed by console output?



[TOPIC: post.html]
#3

harrison.minibucks

[GLOBAL: userInfoPane.html]
harrison.minibucks
  • Observer

  • 6 posts
  • Corona SDK

Hi Scott, thanks for the reply, I've just dropped you a message.




[topic_controls]
[/topic_controls]