c#中的OAuth2令牌到期时间

时间:2015-08-23 22:42:13

标签: c# uwp

我在uwp上写app。我必须从login.live.com获取令牌,但我不知道如何获得此令牌的到期时间。我有那个代码:

using UnityEngine;
using System.Collections;

public class AntiRollBar : MonoBehaviour {
    public WheelCollider wheelL;
    public WheelCollider wheelR;
    public float antiRollVal = 5000f;

    // Update is called once per frame
    void Update () {
        WheelHit hit;
        float travelL=1.0f;
        float travelR=1.0f;
        bool groundedL = wheelL.GetGroundHit(out hit);
        if (groundedL){
            travelL = (-wheelL.transform.InverseTransformPoint(hit.point).y - wheelL.radius) / wheelL.suspensionDistance;
        }
        bool groundedR = wheelR.GetGroundHit(out hit);
        if (groundedR){
            travelR = (-wheelR.transform.InverseTransformPoint(hit.point).y - wheelR.radius) / wheelR.suspensionDistance;                   
        }

        float antiRollForce = (travelL - travelR) * antiRollVal;

        if (groundedL)

            GetComponent<Rigidbody>().AddForceAtPosition(wheelL.transform.up * -antiRollForce,

                                         wheelL.transform.position);  

        if (groundedR)

            GetComponent<Rigidbody>().AddForceAtPosition(wheelR.transform.up * antiRollForce,

                                         wheelR.transform.position);  
    }
}

1 个答案:

答案 0 :(得分:0)

为令牌请求收到的http响应将有一个名为“expires_in”的参数。从此值开始,您应该能够导出令牌到期的持续时间。查看OAuth2.0 Live Connect文档。