How to add own OAuth Server

Discussion in 'Tips and tricks' started by GermanHero, Feb 5, 2019.

Tags:
  1. GermanHero

    GermanHero New Member

    Joined:
    Nov 15, 2018
    Messages:
    9
    Likes Received:
    0
    S.E:
    2019-11-15 18:56:17
    L.T:
    Regular
    L.C:
    1
    Hello i got my owh OAuth Server. But i din't work with Yii Framework before ..
    Can you tell me how i add Oauth Client to MailWizz ?
    Which files to edit

    best regards
     
  2. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,942
    Likes Received:
    2,328
    What do you try to accomplish?
     
  3. GermanHero

    GermanHero New Member

    Joined:
    Nov 15, 2018
    Messages:
    9
    Likes Received:
    0
    S.E:
    2019-11-15 18:56:17
    L.T:
    Regular
    L.C:
    1
    I want to add a OAuth2 Client to the application ...
    I got my own OAuth2 Server (based on https://github.com/bshaffer/oauth2-server-php)
    With non framework applications ..on my server i add a link that calls my oauth2login.php on the application server and accomplish the oauth tokens handling with this php and if successfull i set the session data and auto log in the user

    So i want to do the same with your app ... but i don't know how to add a OAuth Client to the Yii framework ..
    i tried with what i read here
    https://github.com/yiisoft/yii2-authclient
    and here
    https://www.yiiframework.com/extension/yiisoft/yii2-authclient/doc/api/2.1/yii-authclient-oauth2
    https://mushtaq.ch/blog/2/facebook-authentication-using-yii2-authclient

    but when i try to add yii2-authclient

    php composer.phar require --prefer-dist yiisoft/yii2-authclient "*"

    i get alot of erros .. is there no other way ?

    i just want to authenticate with my own oauth server

    please give me some adives
    thank you very much !
     
  4. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    9,942
    Likes Received:
    2,328
    Our app is yii1, so that package won't work because it is for yii2.
    Here's the thing, have a look at /apps/customer/controllers/GuestController.php where we auth customers.
    You can simply create your own controller where you direct user after they get your oauth token and based on that token find them in mailwizz and auth them. The GuestController.php file contains all the info you need to automatically auth someone.
     
  5. GermanHero

    GermanHero New Member

    Joined:
    Nov 15, 2018
    Messages:
    9
    Likes Received:
    0
    S.E:
    2019-11-15 18:56:17
    L.T:
    Regular
    L.C:
    1
    thank you very much .. this pointed me to the right direction ; )
     

Share This Page