Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Scott's Google Sign-In
Started by vb66r55 Dec 08 2018 07:29 AM

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

vb66r55

[GLOBAL: userInfoPane.html]
vb66r55
  • Enthusiast

  • 65 posts
  • Corona SDK

Dear Scott,

 

I can use the Google Sign-In plugin to log in, but after I display the result, I can only print the result of event.accessToken, there is no way to print the result of event.serverAuthCode.
 
But I see that your documentation is Acquired.
 
Because I need to make a link with playfab, I need to get serverAuthCode.
 
How can I do this?
 
Thank you.

 



[TOPIC: post.html]
#2

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,281 posts
  • Corona SDK

Why don't you use the regular Corona Google Plugin? it returns the AuthCode in the event. My code is a little code but look at the documentation, I doubt it has changed much.





local gpgs = require( "plugin.gpgs" )
local googlePlayServicesListerner

googlePlayServicesListerner = function(event)
    
    if event.isError == false then
        if event.name == "init" then
           
            gpgs.login( {userInitiated = true, listener = googlePlayServicesListerner} )
            
        elseif event.name == "login" and event.phase == "logged in" then
            gpgs.getServerAuthCode( {serverId=<yourserverId>, listener = googlePlayServicesListerner} )
           
        elseif event.name == "getServerAuthCode" then 
            local authcode = event.code
         -- event.code is the authcode.
        end
    end
end





gpgs.init( googlePlayServicesListerner )


  • vb66r55 likes this

[TOPIC: post.html]
#3

vb66r55

[GLOBAL: userInfoPane.html]
vb66r55
  • Enthusiast

  • 65 posts
  • Corona SDK

 

Why don't you use the regular Corona Google Plugin? it returns the AuthCode in the event. My code is a little code but look at the documentation, I doubt it has changed much.




local gpgs = require( "plugin.gpgs" )
local googlePlayServicesListerner

googlePlayServicesListerner = function(event)
    
    if event.isError == false then
        if event.name == "init" then
           
            gpgs.login( {userInitiated = true, listener = googlePlayServicesListerner} )
            
        elseif event.name == "login" and event.phase == "logged in" then
            gpgs.getServerAuthCode( {serverId=<yourserverId>, listener = googlePlayServicesListerner} )
           
        elseif event.name == "getServerAuthCode" then 
            local authcode = event.code
         -- event.code is the authcode.
        end
    end
end





gpgs.init( googlePlayServicesListerner )

Thank your answer,

 

I use your method successfully logged in.

 

But when I canceled the software and clear the data, I wanted to perform the second test, the sign-in dialog could not appear.

 

I used the text to indicate the current status, but stayed in the login.

 

After I checked the Google Play Game Services API,it responded.

 

But I can't call the sign-in dialog again.

 

How can I fix it?

 

 

In addition, his status has been stuck in "login", I don't know if my serverId is correct.

 

I am using the paragraph with the red text in the picture. Can I choose the wrong one?

 

Thank you.

Attached Files



[TOPIC: post.html]
#4

Scott Harrison

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

  • 1,822 posts
  • Enterprise

Add support for this see docs for ios( note sever client id) and android should work out of the box



[TOPIC: post.html]
#5

vb66r55

[GLOBAL: userInfoPane.html]
vb66r55
  • Enthusiast

  • 65 posts
  • Corona SDK

Add support for this see docs for ios( note sever client id) and android should work out of the box

Thank you Mr.Scott,

 

I have solved this problem.

 

I purchased your Firebase Auth plugin, but I found Site Not Found when I clicked on the description site.

 

I tried to use the phone to open the same problem.

 

Is there a way to solve it? I want to check the documentation of the plugin.

 

Thank you.



[TOPIC: post.html]
#6

Scott Harrison

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

  • 1,822 posts
  • Enterprise

^docs should be fixed




[topic_controls]
[/topic_controls]