Search Unity

GitHub Login + Token

Discussion in 'iOS and tvOS' started by sama-van, Mar 15, 2018.

  1. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Following the documentation :

    - https://developer.github.com/apps/building-oauth-apps/authorization-options-for-oauth-apps/

    I am trying to find a way to :
    - login user
    - get the token
    - download single files from the a git repository.

    Well so far...
    - I have made a github app, then I have the client_id and the client_secret.

    Making research I found this url works to request permission to user for your app :

    url = "https://github.com/login/oauth/authorize?scrop=user:email&client_id=" + client_id

    Well if you copy past the url with your client ID directly into the browser it will redirect you to your home page url with a form like :
    https://www.yourhomepage.com/?code=2ce706d933c922d7f22c

    The code always change on each login or session.


    Finally back to Unity, you can use a WWWForm, etc... with the following data to get receive the token :
    - url = https://github.com/login/oauth/access_token
    - client_id = xxxx (from your app detail)
    - client_secret = xxxx (from your app detail)
    - code = xxxx (from the previous step.


    Then the big question is how to make a proper Github login from Unity to get the "code".

    Next step would be to download a raw file from Github with the token, and already testing this out.

    Anyone?....
     
  2. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
  3. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734