weixin_39777497
weixin_39777497
2020-12-08 21:26

Auth form in my Unity App

Hi! my taget create form in my app on Unity, for get plaget info of auth user in my app

next logic: 1 - user open app 2 - in app auth form interface by login and password, how in online games 2.1 - or there is another way? 3 - from app form, send to patreon api login and pasword 4 - patreon api return info by auth user 5 - app check pleget info (0$ 1$ 5$ 10$ +++) 6 - if user pleget more then 0$ app enable plaget content

if this posible to do? i have php sql hosting and can, crate my api on my hostig for redirect user data from my app form but i cont find any api! for post login (email) and pasword (maybe it's done for safety)

but how i can identify user info in my app?

该提问来源于开源项目:Patreon/patreon-php

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39777497 weixin_39777497 5月前

    and now i test by class OAuth in here source (https://github.com/Patreon/patreon-php)

    
    $client_id = {Client ID}; 
    $client_secret = {Client Secret}; 
    
    $oauth_client = new OAuth($client_id, $client_secret);
    
    $redirect_uri = "{http://my site url for get token}";
    
    $tokens = $oauth_client->get_tokens($_GET['code'], $redirect_uri);
    

    what i see? access_denied how?

    点赞 评论 复制链接分享
  • weixin_39777497 weixin_39777497 5月前

    gg complete! nice work guys(((

    my problem was in redirect_uri in patreon client url: {mysite}.com/ in my api i use: {mysite}.com/index.php

    patreon api return error: invalid_grant or invalid_client

    i test api of worldpres, this is bad((( patreon get all time DDOS one time of butoon (login) calls 10 api to patreon.com

    1 current_user/campaigns?include=creator (Unauthorized) 2 refresh_token (invalid_grant) 3 current_user/campaigns?include=creator (Unauthorized) 4 authorization_code (result ok) 5 current_user (result user data ok) 6 redirect to this again 7 current_user/campaigns?include=creator (Unauthorized) 8 refresh_token (invalid_grant) 9 current_user/campaigns?include=creator (Unauthorized) 10 current_user (result user data ok)

    nice work ;)

    点赞 评论 复制链接分享
  • weixin_39762666 weixin_39762666 5月前

    Hey

    I'd recommend checking out our API v2 documentation here: https://docs.patreon.com/#get-api-oauth2-v2-members-id

    The php client lib isn't updated for v2 yet, but after going through the Oauth flow you should be able to verify the authenticated users membership information via currently_entitled_tiers and last_charge_status. With that information you can grant access to the content based on whether or not it meets the tier and the status is paid.

    点赞 评论 复制链接分享
  • weixin_39777497 weixin_39777497 5月前

    ok now i go to this way https://www.patreondevelopers.com/t/how-to-create-a-login-with-patreon-button/495

    A user visits your website and clicks “Login with Patreon” which is a Login button URL 9 containing your client ID and redirect URI – note: you can also automatically redirect, it doesn’t have to be a login button The user is asked by Patreon if they authorise your application to have access to their account information, if the user clicks accept: The user is redirected back to your website with a code parameter You take the code parameter value and send it to the Patreon API asking for an access token Patreon responds to your request with an access token which grants you access to the Patreon API on behalf of the user who logged in via Patreon Optional: You store the access token associated with the user in some way (session, local storage, database etc.) You make requests to the Patreon API with the access token to retrieve the user’s information

    i use API v1

    1 i create button - https://www.patreon.com/oauth2/authorize?response_type=code&client_id={my patreon client id}

    2 in my php hosting i get result parameter code from patreon site

    3 next i create function

    
    function patreon_post($bearer,$url,$post = array()){
    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
    
        $authorization_header = "Authorization: Bearer ".$bearer;
    
        curl_setopt($ch, CURLOPT_HTTPHEADER, array($authorization_header));
    
        $result = curl_exec($ch);
        $info = curl_getinfo($ch);
    
        curl_close($ch);
    
        return
            array($result,$info);
    }
    

    4 next code

    
    $token_v1 = "{Creator's Access Token}";
    $post_v1 = array(
    
        "code" =>$_GET["code"],
    
        "grant_type"=>"authorization_code",
    
        "client_id"=>"{Client ID}",
        "client_secret"=>"{Client Secret}",
    
        "redirect_uri"=>"http://my site url for get token",
    );
    
    print_r(patreon_post($token_v1,"https://www.patreon.com/api/oauth2/token",$post_v1));
    

    5 and here i die(((

    6 result of this request patreon_post($token_v1,"https://www.patreon.com/api/oauth2/token",$post_v1) return {"error": "invalid_client"}

    what i do wrong?

    点赞 评论 复制链接分享

相关推荐