VLFONE, RAMP and Google OAuth2

This forum allows developers to post programming tips and coding techniques that may be useful to other Visual LANSA developers. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
User avatar
Posts: 254
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC

VLFONE, RAMP and Google OAuth2

Post by Dino » Tue Jun 21, 2022 8:19 am

Let's say you want to access your RAMP application using Google Oauth2 instead of having to type your user and password in VLF-ONE.

Just summarizing the steps here:

1. Go to your google account, Google Cloud Platform in the console.cloud.google.com and create a credential Client ID for Web application indicating the URIs that will take the redirect:
googlevlf01.png (126.67 KiB) Viewed 58 times
2. Once you done that, Go to your VL IDE,
select Package Manager,
Packages, Integration Library, Install if not installed, then,
Tools, Configure Integration Services, OAuth2, Google, then enter the Client ID and Client Secret. SAVE.
googlevlf02.png (39.69 KiB) Viewed 58 times
3. Create your VLF-ONE project, with RAMP, include a Launch Page and Custom System IIP, logon validatos and in it change the LogOnHandlerID to ("External=Google") in the Launche page, for example:

Code: Select all

#VLF_ONE.uInitialize FrameworkIdentifer("T0310_FRAMEWORK") LogonExpiry(90) LogOnHeaderPanelId("UF_OHEADP") LogOnTrailerPanelId("UF_OTRALP") LogOnHandlerId("External=Google") PasswordChangerId("") MtxtLoaderId("UF_OMULTI") ThemeCustomizerId("") ShowRestartButton(True)
4. Notice that the Logon validation (T0310_LogonValidation in my example) have parameters like RAMPUser and RAMPPassword:
googlevlf03.png (58.89 KiB) Viewed 58 times
so a simple code like this or something more complicated will do it without problem (you receive the email already approved by google, can use it to find a user and password to use (1 by 1, 1 to many, etc.), and you assign the user to work with RAMP using the parameters #RampUser and #RampPassword:

Code: Select all

#UserProfiletoCheck := #Com_Owner.ExternalLogon_PrimaryEmail.AsNativeString
#UserNametoDisplay := #Com_Owner.ExternalLogon_FirstName + " " + #ExternalLogon_GivenName
Fetch Fields(#EMUUSER #EMUPASS) From_File(EMAILSANDUSERS) With_Key(#Com_Owner.ExternalLogon_PrimaryEmail.AsNativeString.UpperCase)
#RAMPPassword := #EMUPASS
this user and password are handled internally, they wont be visible in a fiddler. off course, you can encrypt the data in your table, etc.


documentation is here: https://docs.lansa.com/15/en/lansa048/i ... ght=google

Post Reply