How can i get Loggin from another site?

*** Used Zammad version: 2.5**
*** Operating system: Ubuntu 16.04**
*** Browser: Chrome**

I would like to log into my zammad account redirected from another site.
On my site working with CURL, I create a user on zammad with the same access data with which a user just created the account

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, ZAMMAD_LINK . “/api/v1/users”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, “{“firstname”:”".$customer_info[‘firstname’]."",“lastname”:"".$customer_info[‘lastname’]."",“email”:"".$customer_info[‘email’]."",“roles”:[“Customer”],“password”:"".$customer_info[‘password’].""}");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, ZAMMAD_ADMIN);

$headers = array();
$headers[] = “Content-Type: application/json”;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

I have no problems in that part.
my problem is:

I would like to log into zammad’s account with a “login to zammad” button on the user’s account without logging in again in zammad site

i’m using MVC

PHP

// http://"example@hotmail.com":“123123”@localhost:3000/#login
or
// localhost:3000/#login?login=login&password=password

$data[‘zammad_login’] = link to login in zammad account

HTML:

  <a href='<?php echo $zammad_login; ?>' target="_blank">
    <button>
         Login in my Zammad
    </button>
  </a>

how can I redirect the user on my site to zammad’s site without logging in again?

I’ve tried to send parameters to login link, but this doesn’t work!

// http://"example@hotmail.com":“123123”@localhost:3000/#login
or
// localhost:3000/#login?login=login&password=password

$data[‘zammad_login’] = link to login in zammad account

The best solution would be to add oauth2 to your PHP site and configure this oauth2 provider in Zammad, under Manage > Settings > Security. All other solutions (where you would pass the password around) would be hacks and security problems waiting to happen.

The good news is, there’s probably easy pre-baked modules for your app platform to add oauth2 to your app.

First Thanks!

But,

Can u show me a example of pre-baked module?

I don’t find examples in GitHub,

i’m with extreme difficult to implement it in my site!

Hi, for php there seems to be this: https://bshaffer.github.io/oauth2-server-php-docs/

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.