Open Beor18 opened 3 years ago
There are several code snippets in the EntitlementView documentation that show some of the simplest use cases. https://github.com/rokudev/SceneGraphDeveloperExtensions/blob/master/documentation/1-components.md#entitlementview
If you're interested in username/password authentication, this one is probably the most helpful...
ent = CreateObject("roSGNode", "EntitlementView")
ent.mode = "UserPass"
ent.ObserveField("isAuthenticated", "OnIsAuthenticated")
content = CreateObject("roSGNode", "ContentNode")
content.Update({
handlerConfigEntitlement: {
name: "myAuthHandler"
}
}, true)
ent.content = content
m.top.ComponentController.callFunc("show", {view: ent})
yes, but I don't understand when it says create the view .. at that point, what would I have to create?
The view in this case is an SGDEX EntitlementView. It's created by this line of code...
ent = CreateObject("roSGNode", "EntitlementView")
The only other thing you need to do is build an EntitlementHandler similar to the one in the RokuPay sample. In that handler, you should define a function called Authenticate()
that contains whatever auth logic you need for your particular channel. Once the user enters their credentials, SGDEX will pass them to that function.
function Authenticate(username as String, password as String) as Boolean
thanks you!
I have the same problem; I did the LoginView but now I need to go to main controller
It is possible to create a custom task for login?
Yes it is. Our recommendation would be to use EntitlementView and EntitlementHandler for authentication. But if those don't meet your requirements, you can certainly build whatever custom Tasks you need for your channel.
I try now, thanks for the answer :)
I got it! but if I want to logout and delete all stack of navigation what can I do? @RokuChris
Each view has close and wasClosed fields that you can set and observe respectively to manage the stack.
somethings like this ?
function CloseAllScreens()
? "CloseAllScreens() "
if m.loginView <> invalid
? "CloseAllScreens() m.loginView close = true"
m.loginView = invalid
endif
if m.accountView <> invalid
? "CloseAllScreens() m.accountView close = true"
m.accountView = invalid
endif
if m.top.componentController <> invalid
? "CloseAllScreens() m.componentController close = true"
'm.top.componentController.close = true
endif
end function
'
Cause after I logged out , I stil lhave the button bar stuff
I still have the same problem
Il giorno mar 27 lug 2021 alle ore 19:16 RokuChris @.***> ha scritto:
Each view has close and wasClosed fields that you can set and observe respectively to manage the stack.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rokudev/SceneGraphDeveloperExtensions/issues/55#issuecomment-887687809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLUZA3QZTSOMXRMFQMNSZLTZ3SVXANCNFSM4UUDA2VA .
--
Allan Nava direct: +39 340 94 77 141 @. @.>*
It would be nice to create a simple login example without much logic.