Invitation based authentication in Rails -


i'm new ror , trying build invite based auth. currently, i'm using omniauth-facebook have login using fb on site. however, want users have custom url - "www.mysite.com/invite/" can share drive signup. track these referrals incentivise users drive such logins. i'm absolutely clueless how proceed , starting pointers great.

one way have route '/invite/:invite_code' , before "/auth/facebook" triggered read invite code , increment counter how check if "/auth/facebook" called invite page only. sound correct? or there better solutions out there?

thanks lot!

you make post auth/facebook having more or less code in omniauth callbacks controller:

def facebook   invitation.increment if request.env['omniauth.params'][:from_invitation_page]   # or   # invitation.increment if request.env['omniauth.origin'].match /your_invitation_url/ 

see that:

request.env['omniauth.origin'] 

is set automatically, while:

request.env['omniauth.params'] 

is set rendering link like:

omniauth_authorize_path(:user, :facebook, var: 'value', var2: 'value2' ) 

source


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -