Jump to content


Help with sso login with p4api.net

p4api.net login

  • Please log in to reply
2 replies to this topic

#1 harshareddy

harshareddy

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 07 August 2014 - 04:24 AM

Hi,

I am using p4api.net for quite a few Perforce operations. At the moment, for login, I am asking the user for the password and then using the Login method to authenticate the user.

The users also have p4v on the machine and are generally logged in with p4v. I wanted to know if there is anyway I can piggyback on the session of p4v (use the same ticket) and completely bypass the earlier mechanism of asking the user for password and then logging in.

Any ideas on how I can do this?

Also, is there any way to access from p4api.net the variables that are set by p4 set command (like P$CLIENT, P$EDITOR etc)?

Thanks,
Harsha

#2 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 08 August 2014 - 12:05 AM

Hi harshareddy,

Are you using ticket-based authentication for the user login?

  http://www.perforce....figuration.html

If so, to implement the "p4 tickets" command in your app, find the tickets
file (P4TICKETS if set, $HOME/.p4tickets or %USERPROFILE%/p4tickets.txt
if not) and print it to the screen.

You can use the "p4 login -p" or "p4 login -p -a" commands to create a string that contains the encrypted string of a Perforce ticket. See

   - Logging In to Perforce Non-interactively
http://answers.perfo...n-interactively

You can use this output to generate tickets or modify existing tickets.

EXAMPLE

$ p4 logout
User bruno logged out.

$ p4 login -p -a
Enter password:
423EF77214DC4E88D8B7A639A28DEE21

$ vi ~/.p4tickets
(added in string)

$ p4 login -s
User bruno ticket expires in 11 hours 59 minutes.

You can use that ticket with the p4api program.

Regarding accessing variables, there is an example in this article here:

- A Basic P4API.NET Program
http://answers.perfo...API-NET-Program


REFERENCES

- Triggers and Passwords
http://answers.perfo...s-and-Passwords

- Connection time limits
http://www.perforce....figuration.html

- Avoiding the Perforce Prompt for Password in Windows -
http://answers.perfo...word-in-Windows

#3 harshareddy

harshareddy

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 31 August 2014 - 11:30 AM

Thanks a lot. That is exactly what I needed. Worked like a charm.





Also tagged with one or more of these keywords: p4api.net, login

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users